The first step is to install SWTBot from the Eclipse update site. These examples were tested with Version 2.1.0, downloaded from http://download.eclipse.org/technology/swtbot/releases/latest/. Note that Eclipse Kepler (4.3) requires SWTBot 2.1.1 or above.
Go to Help | Install New Software and enter the SWTBot update site.
Select everything except the GEF feature:
Restart Eclipse, when prompted.
Add the following bundle dependencies to the plug-in manifest for the
com.packtpub.e4.junit.plugin
project:org.eclipse.swtbot.junit4_x
org.eclipse.swtbot.forms.finder
org.eclipse.swtbot.eclipse.finder
org.eclipse.ui
Create a class called
UITest
in thecom.packtpub.e4.junit.plugin
package.Add a class annotation
@RunWith(SWTBotJunit4ClassRunner.class)
.Create a method called
testUI()
with an annotation@Test
.Inside the
testUI()
method, create an instance ofSWTWorkbenchBot
.Iterate through the bot's
shells()
method and assert that...