If you really need to invoke or execute code that needs UI-thread (such as opening an editor without simulating click on New and so on), you can use Display.getDefault().syncExec() to wrap the piece of code that requires UI-thread in your tests:
@Test
public void testDiagram() throws ExecutionException {
// part of test that requires UI-thread
Display.getDefault().syncExec(new Runnable() {
public void run() {
try {
new NewProcessCommandHandler().execute(null); // requires UI-thread since it is gonna invoke PlatformUI.getWorkbench()
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
// Normal SWTBot execution
SWTBotEditor botEditor = bot.activeEditor();
SWTBotGefEditor gmfEditor = bot.gefEditor(botEditor.getTitle());
gmfEditor.activateTool("Step");
gmfEditor.mouseMoveLeftClick(200, 200);