0

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?

mazab
  • 1
  • 1
  • You should consider updating your question/question title to emphasise what you are trying to achieve (run SWTBOT tests in fresh workspaces). For this, it may also help to move the things that you tried to achieve your goal out into a comment to your own question. – oberlies Aug 27 '12 at 09:21

1 Answers1

0

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.

Fredrik
  • 10,626
  • 6
  • 45
  • 81
  • I did that, but It didn't work. The following exception occurred: java.lang.ClassNotFoundException Could not find the main class ,, And how to specify a -data option for each test ? I tried to change it during the first test to be considered in the later tests but it didn't – mazab Aug 12 '12 at 13:56