Note that SWTBot works on a non-UI thread by default to avoid 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 show menus.
Create a new test method in the
UITest
class calledcreateProject
with a@Test
annotation.Create a new
SWTWorkbenchBot
instance.Use the
menu
method of thebot
to navigate the File | Project... menus, and perform aclick
.Use the
shell
method of thebot
to get the newly openedshell
with a title ofNew Project
. Activate the shell to ensure that it has focus.Use the
tree
method of thebot
to find a tree in the shell, andexpandNode
theGeneral
node, and finallyselect
theProject
.Invoke the
Next >
button with aclick
. Note the space between theNext
and...