Discussion:
SWTBot
(too old to reply)
Reiner Fäth
2012-01-09 14:57:29 UTC
Permalink
Hello,
I'm trying to build and test an Eclipse RCP Application.
The Build and JUnit test runns successfully. But when I'm trying to test
the application with SWTBot I get a problem.

When I run the SWTBot test with "mvn integration-test" or upper phases I
only get:

[INFO] Command line:
cmd.exe /X /C "C:\Programme\Java\jdk1.6.0_
24\jre\bin\java.exe
-Dosgi.noShutdown=false
-Dosgi.os=win32
-Dosgi.ws=win32
-Dosgi.arch=x86
-jar
C:\local_repo\p2\osgi\bundle\org.eclipse.equinox.launcher\1.2.0.v20110502\org.eclipse.equinox.launcher-1.2.0.v20110502.jar

-data C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work\data
-dev
file:/C:/Eclipse/Workspace/prototype/de.prototype.tests/target/dev.properties

-install C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work
-configuration
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work\configuration
-application org.eclipse.tycho.surefire.osgibooter.uitest
-testproperties
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\surefire.properties

-testApplication de..prototype.main.application
-product de.prototype.main.de_prototype_product
-nouithread"
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1:07.521s
[INFO] Finished at: Mon Jan 09 15:13:51 CET 2012
[INFO] Final Memory: 49M/118M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.eclipse.tycho:tycho-surefire-plugin:0.13.0:test (default-test) on
project de.prototype.tests: There are test failures.
[ERROR]
[ERROR] Please refer to
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\surefire-reports
for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

But there were no surefire-reports in that direction. In
de.prototype.tests\target\classes\de\prototype\tests\ there can be found
the Test-Class "OpenDialogTests.class"
Is there anything wrong with the naming of the class, or what can I do to
get the test run?

Thanks in advance

Best Regards

DarkPhoenix
Igor Fedorenko
2012-01-09 15:01:07 UTC
Permalink
For SWTBot you need to specify the following in tycho-surefire-plugin
configuration

<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>


--
Regards,
Igor
Post by Reiner Fäth
Hello,
I'm trying to build and test an Eclipse RCP Application.
The Build and JUnit test runns successfully. But when I'm trying to test
the application with SWTBot I get a problem.
When I run the SWTBot test with "mvn integration-test" or upper phases I
cmd.exe /X /C "C:\Programme\Java\jdk1.6.0_
24\jre\bin\java.exe
-Dosgi.noShutdown=false
-Dosgi.os=win32
-Dosgi.ws=win32
-Dosgi.arch=x86
-jar
C:\local_repo\p2\osgi\bundle\org.eclipse.equinox.launcher\1.2.0.v20110502\org.eclipse.equinox.launcher-1.2.0.v20110502.jar
-data C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work\data
-dev
file:/C:/Eclipse/Workspace/prototype/de.prototype.tests/target/dev.properties
-install C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work
-configuration
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work\configuration
-application org.eclipse.tycho.surefire.osgibooter.uitest
-testproperties
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\surefire.properties
-testApplication de..prototype.main.application
-product de.prototype.main.de_prototype_product
-nouithread"
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1:07.521s
[INFO] Finished at: Mon Jan 09 15:13:51 CET 2012
[INFO] Final Memory: 49M/118M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.eclipse.tycho:tycho-surefire-plugin:0.13.0:test (default-test) on
project de.prototype.tests: There are test failures.
[ERROR]
[ERROR] Please refer to
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\surefire-reports for
the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the
-e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
But there were no surefire-reports in that direction. In
de.prototype.tests\target\classes\de\prototype\tests\ there can be found
the Test-Class "OpenDialogTests.class"
Is there anything wrong with the naming of the class, or what can I do
to get the test run?
Thanks in advance
Best Regards
DarkPhoenix
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Reiner Fäth
2012-01-09 15:33:38 UTC
Permalink
I have that, so thats unfortunately not the problem. When it helps, here is
my pom:
<parent>
<artifactId>prototype</artifactId>
<groupId>test</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>test</groupId>
<artifactId>de.prototype.tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>

<build>
<plugins>
<plugin>
<artifactId>tycho-surefire-plugin</artifactId>
<groupId>org.eclipse.tycho</groupId>
<version>0.13.0</version>
<configuration>
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
<product>de.prototype.main.de_prototype_product</product>
<application>de.prototype.main.application</application>
<dependencies>

<!--Dependancies for the Test-->

<dependency>
<artifactId>de.prototype.main</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>de.prototype.model</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>de.prototype.navigation</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>

Best Regards

DarkPhoenix
Post by Igor Fedorenko
For SWTBot you need to specify the following in tycho-surefire-plugin
configuration
<useUIHarness>true</
useUIHarness>
<useUIThread>false</useUIThread>
--
Regards,
Igor
Hello,
I'm trying to build and test an Eclipse RCP Application.
The Build and JUnit test runns successfully. But when I'm trying to test
the application with SWTBot I get a problem.
When I run the SWTBot test with "mvn integration-test" or upper phases I
cmd.exe /X /C "C:\Programme\Java\jdk1.6.0_
24\jre\bin\java.exe
-Dosgi.noShutdown=false
-Dosgi.os=win32
-Dosgi.ws=win32
-Dosgi.arch=x86
-jar
C:\local_repo\p2\osgi\bundle\org.eclipse.equinox.launcher\1.2.0.v20110502\org.eclipse.equinox.launcher-1.2.0.v20110502.jar
Post by Igor Fedorenko
-data C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work\data
-dev
file:/C:/Eclipse/Workspace/prototype/de.prototype.tests/target/dev.properties
Post by Igor Fedorenko
-install C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work
-configuration
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work\configuration
Post by Igor Fedorenko
-application org.eclipse.tycho.surefire.osgibooter.uitest
-testproperties
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\surefire.properties
Post by Igor Fedorenko
-testApplication de..prototype.main.application
-product de.prototype.main.de_prototype_product
-nouithread"
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1:07.521s
[INFO] Finished at: Mon Jan 09 15:13:51 CET 2012
[INFO] Final Memory: 49M/118M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.eclipse.tycho:tycho-surefire-plugin:0.13.0:test (default-test) on
project de.prototype.tests: There are test failures.
[ERROR]
[ERROR] Please refer to
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\surefire-reports
for
Post by Igor Fedorenko
the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the
-e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
But there were no surefire-reports in that direction. In
de.prototype.tests\target\classes\de\prototype\tests\ there can be found
the Test-Class "OpenDialogTests.class"
Is there anything wrong with the naming of the class, or what can I do
to get the test run?
Thanks in advance
Best Regards
DarkPhoenix
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Reiner Fäth
2012-01-10 14:24:04 UTC
Permalink
Could someone please help me with that problem?
There is no point I can refer to,the test runs in Eclipse without problems
so I think there is a problem by starting the test?
Here is the test-code:

//@RunWith(SWTBotJunit4ClassRunner.class)
public class OpenDialogTest
{
SWTWorkbenchBot bot = new SWTWorkbenchBot();

@Test
public void openMessageDialogTest()
{
// Clicks on the first link, the bot finds in the application
bot.link().click();

// Wait until MessageDialog with this titel appears
bot.waitUntil(shellIsActive("Not Implemented")); //$NON-NLS-1$

// Not intuitive, but the message in a MessageDialog seems to be a
Label with Index 1!
final String message = bot.label(1).getText();
assertEquals("Check, if the message equals this text: ", "Imagine
the address book or a new message being created now.", message);
//$NON-NLS-1$ //$NON-NLS-2$

// Close the dialog
bot.button().click();
}
}
Post by Reiner Fäth
I have that, so thats unfortunately not the problem. When it helps, here
<parent>
<artifactId>prototype</artifactId>
<groupId>test</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>test</groupId>
<artifactId>de.prototype.tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<build>
<plugins>
<plugin>
<artifactId>tycho-surefire-plugin</artifactId>
<groupId>org.eclipse.tycho</groupId>
<version>0.13.0</version>
<configuration>
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
<product>de.prototype.main.de_prototype_product</product>
<application>de.prototype.main.application</application>
<dependencies>
<!--Dependancies for the Test-->
<dependency>
<artifactId>de.prototype.main</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>de.prototype.model</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>de.prototype.navigation</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
Best Regards
DarkPhoenix
Post by Igor Fedorenko
For SWTBot you need to specify the following in tycho-surefire-plugin
configuration
<useUIHarness>true</
useUIHarness>
<useUIThread>false</useUIThread>
--
Regards,
Igor
Hello,
I'm trying to build and test an Eclipse RCP Application.
The Build and JUnit test runns successfully. But when I'm trying to test
the application with SWTBot I get a problem.
When I run the SWTBot test with "mvn integration-test" or upper phases I
cmd.exe /X /C "C:\Programme\Java\jdk1.6.0_
24\jre\bin\java.exe
-Dosgi.noShutdown=false
-Dosgi.os=win32
-Dosgi.ws=win32
-Dosgi.arch=x86
-jar
C:\local_repo\p2\osgi\bundle\org.eclipse.equinox.launcher\1.2.0.v20110502\org.eclipse.equinox.launcher-1.2.0.v20110502.jar
Post by Igor Fedorenko
-data C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work\data
-dev
file:/C:/Eclipse/Workspace/prototype/de.prototype.tests/target/dev.properties
Post by Igor Fedorenko
-install C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work
-configuration
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\work\configuration
Post by Igor Fedorenko
-application org.eclipse.tycho.surefire.osgibooter.uitest
-testproperties
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\surefire.properties
Post by Igor Fedorenko
-testApplication de..prototype.main.application
-product de.prototype.main.de_prototype_product
-nouithread"
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1:07.521s
[INFO] Finished at: Mon Jan 09 15:13:51 CET 2012
[INFO] Final Memory: 49M/118M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.eclipse.tycho:tycho-surefire-plugin:0.13.0:test (default-test) on
project de.prototype.tests: There are test failures.
[ERROR]
[ERROR] Please refer to
C:\Eclipse\Workspace\prototype\de.prototype.tests\target\surefire-reports
for
Post by Igor Fedorenko
the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the
-e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
But there were no surefire-reports in that direction. In
de.prototype.tests\target\classes\de\prototype\tests\ there can be found
the Test-Class "OpenDialogTests.class"
Is there anything wrong with the naming of the class, or what can I do
to get the test run?
Thanks in advance
Best Regards
DarkPhoenix
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Mickael Istria
2012-01-10 14:30:41 UTC
Permalink
Post by Reiner Fäth
public class OpenDialogTest
[...]
Post by Reiner Fäth
de.prototype.tests\target\classes\de\prototype\tests\ there can
be found
Post by Reiner Fäth
the Test-Class "OpenDialogTests.class"
What is the name of your class? Here are the default configuration of
surefire plugin. Have a look at the default inclusion wildcards:
http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html

HTH
--
Mickael Istria
R&D Engineer, Eclipse Plug-in RCP Developer

PetalsLink <http://www.petalslink.com> - Open Source SOA

My blog <http://mickaelistria.wordpress.com> - My Tweets
<https://twitter.com/#%21/mickaelistria>
Reiner Fäth
2012-01-12 08:16:32 UTC
Permalink
I have checked this and the name of the test class was wrong *Tests.java.
is OpenDialogTest.java and so it generates a OpenDialogTest.class.
Unfortunately that was not the problem, I have the same problem. I tried to
leave aout the dependancies but that was also not the problem,
May it be that the problem can be in the product or application, I don't
think so because the application builds with these configurations and
starts easily...
Don't know what to do :-(
Post by Reiner Fäth
Post by Reiner Fäth
public class OpenDialogTest
[...]
de.prototype.tests\target\
classes\de\prototype\tests\ there can
Post by Reiner Fäth
be found
the Test-Class "OpenDialogTests.class" >>
What is the name of your class? Here are the default configuration of
http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html<http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html>
HTH
--
Cristiano Gavião
2012-01-12 11:30:51 UTC
Permalink
Hi,

You MUST include all dependencies and MUST setup all bundles that you
want to auto-start inside the Tycho-Surefire configurations.

And if you are using a macOS you need some profiles too.

take a look:

<profiles>
<profile>
<id>macosx</id>
<activation>
<os>
<name>mac os x</name>
<family>mac</family>
</os>
</activation>
<properties>
<ui.test.vmargs>-Xmx512m -XX:MaxPermSize=256m
-XstartOnFirstThread</ui.test.vmargs>
</properties>
</profile>
<profile>
<id>other-os</id>
<activation>
<os>
<name>not-mac</name>
<family>!mac</family>
</os>
</activation>
<properties>
<ui.test.vmargs>-Xmx512m -XX:MaxPermSize=256m</ui.test.vmargs>
</properties>
</profile>
</profiles>


<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<includes>
<!-- <include>your.unique.rcpmail.application.test.MyFirstTest</include> -->
<include>**/*Embedder.*</include>
</includes>
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
<product>your.rcp.application.application.product</product>
<showEclipseLog>true</showEclipseLog>
<argLine>${ui.test.vmargs}</argLine>
<failIfNoTests>true</failIfNoTests>
<application>your.rcp.application.application</application>
<bundleStartLevel>
<bundle>
<id>org.eclipse.osgi</id>
<level>-1</level>
<autoStart>true</autoStart>
</bundle>
<bundle>
<id>org.eclipse.equinox.common</id>
<level>1</level>
<autoStart>true</autoStart>
</bundle>
<bundle>
<id>org.eclipse.equinox.simpleconfigurator</id>
<level>1</level>
<autoStart>true</autoStart>
</bundle>
<bundle>
<id>org.eclipse.equinox.ds</id>
<level>2</level>
<autoStart>true</autoStart>
</bundle>
<bundle>
<id>org.eclipse.equinox.events</id>
<level>2</level>
<autoStart>true</autoStart>
</bundle>
<bundle>
<id>org.eclipse.core.runtime</id>
<level>4</level>
<autoStart>true</autoStart>
</bundle>
</bundleStartLevel>

<dependencies>
<dependency>
<type>p2-installable-unit</type>
<artifactId>some.pom-first.plugin.in.another.p2.repository.services</artifactId>
<version>0.0.0</version>
</dependency>
<dependency>
<type>eclipse-feature</type>
<artifactId>your.application.feature</artifactId>
<version>0.0.0</version>
</dependency>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.eclipse.swtbot.eclipse.core</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.eclipse.swtbot.eclipse.finder</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.eclipse.swtbot.eclipse.junit4.headless</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.eclipse.swtbot.junit4_x</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.eclipse.swtbot.swt.finder</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.eclipse.swtbot.eclipse.finder</artifactId>
<version>2.0.5</version>
</dependency>
</dependencies>
</configuration>
</plugin>
Post by Reiner Fäth
I have checked this and the name of the test class was wrong
*Tests.java. is OpenDialogTest.java and so it generates a
OpenDialogTest.class.
Unfortunately that was not the problem, I have the same problem. I
tried to leave aout the dependancies but that was also not the problem,
May it be that the problem can be in the product or application, I
don't think so because the application builds with these
configurations and starts easily...
Don't know what to do :-(
Post by Reiner Fäth
Post by Reiner Fäth
public class OpenDialogTest
[...]
de.prototype.tests\target\
classes\de\prototype\tests\ there can
Post by Reiner Fäth
be found
the Test-Class "OpenDialogTests.class" >>
What is the name of your class? Here are the default configuration of
http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html
HTH
--
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Reiner Fäth
2012-01-12 10:49:27 UTC
Permalink
Ok, I have found the Problem.
For some reason, maven-surfire-plugin does not take the dependancies out of
the pom, it uses the dependancies from the manifest file.
There...the dependancies were missing -> that's why the application can't
start.

Thank you for the help

DarkPhoenix
Continue reading on narkive:
Loading...