I am starting to use SWTBot to test my application Eclipse RCP v4.
This is my code, to get a part via an id and activate it.
protected static void openPart(final String id) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
EPartService partService = E4Workbench.getServiceContext().getActiveLeaf().get(EPartService.class);
MPart part = partService.findPart(id);
partService.activate(part);
}
});
}
This is my tests. And it doesn't work...
@Test
public void test1() {
openPart("testmaker.part.gauche");
bot.tree().getTreeItem("hju / PQT").expand();
}
@Test
public void test2() {
openPart("testmaker.part.stepRightSide");
bot.button("Add Comment").click();
}
I don't know how to link my private static SWTBot bot;
with my RCP Part.
I have already tried with bot.viewby...(name/id/etc).show();
, it doesn't work.
This is my RCP application :
Does anyone can help me to use an rcp app with SWTBot ?
I have the solution now.
With the org.eclipse.swtbot.e4.finder
plugin and the class SWTWorkbenchBot from this plugin it works.