user3706156
user3706156

Reputation: 23

SWTBot Restart rcp application in test

I'm having issues creating a SWTBot test that restarts rcp application. When I run a suite of tests from eclipse, when rcp app restarts it also restarts the suite. So the tests that already ran before the restart, will run again. I read that you can run a sequence of tests separated by restart only using Tycho Surefire, bash... I tried to run with tycho but when the test with restart runs I get the following error:

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:0.20.0:test (default-test) on project projectName.ui.swtbottest: An unexpected error occured (return code -1). See log for details. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:0.20.0:test
(default-test) on project projectName.ui.swtbottest: An unexpected error occured (return code -1). See log for details.

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

Any idea why this happens? It's not enough just running suite with tycho, should I change something in test implementation?

Upvotes: 0

Views: 350

Answers (1)

Mickael
Mickael

Reputation: 3596

You cannot test restart of application from inside Eclipse (with or without SWTBot). Hitting "Restart" will restart the exact same application than the initial one, including execution of tests.

If you want to have several suites with different executions of IDE, you'll need to orchestrate your tests "from the outside" for example by configuring successive invocations to tycho-surefire-plugin.

Upvotes: 1

Related Questions