Note that SWTBot works on a non-UI thread by default, so as to avoid a deadlock with modal dialogs and other user interface actions. If the tests need to interact with specific SWT widgets, it is necessary to invoke a runnable via the UI thread.
To make this easier, the SWTBot framework has several helper methods that can provide a facade of the workspace, including the ability to click on buttons and displaying menus.
Create a new test method called
createProject()
in theUITest
class with a@Test
annotation.Create a new
SWTWorkbenchBot
instance.Use the bot's
menu()
method to navigate to File | Project..., and perform aclick()
.Use the bot's
shell()
method to get the newly opened shell with a title New Project. Activate the shell to ensure that it has focus.Use the bot's
tree()
method to find a tree in the shell and expand the General node, and finally select Project.Invoke the
Next >
button with aclick()
method. Note the space betweenNext
and the...