SWTBOT switch workspace

487 views Asked by At

I am using SWTBOT with tycho-surfire to test an eclipse application. The tests runs individually fine, but when I combine them I need to switch the workspace after each test, or specify somehow a specific workspace for each test. When I try to switch the workspace from inside the test with this code:

<code>
bot.menu("File").menu("Switch Workspace").menu("Other...").click();
bot.shell("Workspace Launcher").activate();
String workspace = bot.comboBoxWithLabel("Workspace:").getText() + "/ResetButtonTest";
bot.comboBoxWithLabel("Workspace:").setText(workspace);
bot.button("OK").click();
</code>

the simulator reaches the OK button and press it, the workbench closes but never starts again. There was an error asking to set the property eclipse.vm, and I did. The error is gone but still can not switch the workspace.

Is there any configuration file or something that I can add to tyco-surfire to configure SWTBot to have a specific workspace for each test it runs? Or even to run each test in a new workbench, and not to continue in the same workbench? Or is there any solution that fixes the problem of switching the workspace from inside the test?

1

There are 1 answers

1
Fredrik On

So for each test you want to set a certain workspace? The test is not about switching workspace?

If you can configure the command that starts up the SWTbot test, you can add -data <my workspace> as a parameter. It will then start up with that workspace.