How to run unit tests in an e4 + e(fx)clipse project? [message #1412416] |
Tue, 26 August 2014 05:26 |
Fernando Paz Messages: 22 Registered: May 2014 |
Junior Member |
|
|
I want to run some JUnit tests in my e4 + e(fx)clipse application, but I'm struggling with Maven at this point.
I've read that the recommended approach[1] is to create an Eclipse fragment and write some tests on it. Accordingly to Tycho wiki[2], I would need to declare a dependency to the feature (because my tests require some plugins provided by e(fx)clipse), so I came up with the following pom for the test fragment:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>lab.poc.unittests.app.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
<name>Unit Tests POC</name>
<description>Unit Tests POC</description>
<parent>
<groupId>lab.poc.unittests</groupId>
<artifactId>lab.poc.unittests.app.releng</artifactId>
<relativePath>../lab.poc.unittests.app.releng/pom.xml</relativePath>
<version>1.0.0</version>
</parent>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<useUIHarness>true</useUIHarness>
<dependencies>
<dependency>
<type>eclipse-feature</type>
<artifactId>lab.poc.unittests.app.feature</artifactId>
<version>0.0.0</version>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
However, when I run mvn clean verify in my releng pom I get the following error:
[INFO] --- tycho-surefire-plugin:0.21.0:test (default-test) @ lab.poc.unittests.app.tests ---
[INFO] Cannot complete the request. Generating details.
[INFO] Cannot complete the request. Generating details.
[INFO] {osgi.os=noenv, osgi.ws=noenv, org.eclipse.update.install.features=true, osgi.arch=noenv}
[ERROR] Cannot resolve project dependencies:
[ERROR] You requested to install 'lab.poc.unittests.app.feature.feature.group 0.0.0' but it could not be found
[ERROR]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Unit Tests POC - releng ........................... SUCCESS [ 0.085 s]
[INFO] Unit Tests POC - application bundle ............... SUCCESS [ 1.710 s]
[INFO] Unit Tests POC - application feature .............. SUCCESS [ 0.292 s]
[INFO] Unit Tests POC - application product .............. SUCCESS [ 5.269 s]
[INFO] Unit Tests POC .................................... FAILURE [ 0.335 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.392 s
[INFO] Finished at: 2014-08-26T17:05:37+12:00
[INFO] Final Memory: 47M/114M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:0.21.0:test (default-test) on project lab.poc.unittests.app.tests: Execution default-test of goal org.eclipse.tycho:tycho-surefire-plugin:0.21.0:test failed: No solution found because the problem is unsatisfiable.: [Unable to satisfy dependency from tycho-extra-1409029537154 0.0.0.1409029537154 to lab.poc.unittests.app.feature.feature.group 0.0.0.; Unable to satisfy dependency from tycho-1409029537177 0.0.0.1409029537177 to lab.poc.unittests.app.feature.feature.group 0.0.0.; No solution found because the problem is unsatisfiable.] -> [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/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :lab.poc.unittests.app.tests
In the end, as the e(fx)clipse uses a different target platform, I'm not even sure if this is right approach to test an e4 + e(fx)clipse project. How are you guys doing this?
[1]: http://www.vogella.com/tutorials/Eclipse4Testing/article.html
[2]: https://wiki.eclipse.org/Tycho/Packaging_Types#eclipse-test-plugin
|
|
|
Re: How to run unit tests in an e4 + e(fx)clipse project? [message #1412441 is a reply to message #1412416] |
Tue, 26 August 2014 07:06 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Hi,
The first question is. Are you writing UI-Tests or NONE-UI-Tests?
Unfortunately the error message tycho provides is not very useful but it
looks like the feature is missing some dependency but I can't tell you
which ones are missing.
Are you able to run your JUnit-Tests inside the IDE?
Tom
On 26.08.14 07:26, Fernando Paz wrote:
> I want to run some JUnit tests in my e4 + e(fx)clipse application, but
> I'm struggling with Maven at this point.
>
> I've read that the recommended approach[1] is to create an Eclipse
> fragment and write some tests on it. Accordingly to Tycho wiki[2], I
> would need to declare a dependency to the feature (because my tests
> require some plugins provided by e(fx)clipse), so I came up with the
> following pom for the test fragment:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd"
> xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <modelVersion>4.0.0</modelVersion>
> <artifactId>lab.poc.unittests.app.tests</artifactId>
> <packaging>eclipse-test-plugin</packaging>
>
> <name>Unit Tests POC</name>
> <description>Unit Tests POC</description>
>
>
> <parent>
> <groupId>lab.poc.unittests</groupId>
> <artifactId>lab.poc.unittests.app.releng</artifactId>
>
> <relativePath>../lab.poc.unittests.app.releng/pom.xml</relativePath>
> <version>1.0.0</version>
> </parent>
>
> <build>
> <sourceDirectory>src</sourceDirectory>
> <plugins>
> <plugin>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>tycho-surefire-plugin</artifactId>
> <version>${tycho-version}</version>
> <configuration>
> <useUIHarness>true</useUIHarness>
> <dependencies>
> <dependency>
> <type>eclipse-feature</type>
>
> <artifactId>lab.poc.unittests.app.feature</artifactId>
> <version>0.0.0</version>
> </dependency>
> </dependencies>
> </configuration>
> </plugin>
> </plugins>
> </build>
>
> </project>
>
>
> However, when I run mvn clean verify in my releng pom I get the
> following error:
>
>
> [INFO] --- tycho-surefire-plugin:0.21.0:test (default-test) @
> lab.poc.unittests.app.tests ---
> [INFO] Cannot complete the request. Generating details.
> [INFO] Cannot complete the request. Generating details.
> [INFO] {osgi.os=noenv, osgi.ws=noenv,
> org.eclipse.update.install.features=true, osgi.arch=noenv}
> [ERROR] Cannot resolve project dependencies:
> [ERROR] You requested to install
> 'lab.poc.unittests.app.feature.feature.group 0.0.0' but it could not be
> found
> [ERROR]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Reactor Summary:
> [INFO]
> [INFO] Unit Tests POC - releng ........................... SUCCESS [
> 0.085 s]
> [INFO] Unit Tests POC - application bundle ............... SUCCESS [
> 1.710 s]
> [INFO] Unit Tests POC - application feature .............. SUCCESS [
> 0.292 s]
> [INFO] Unit Tests POC - application product .............. SUCCESS [
> 5.269 s]
> [INFO] Unit Tests POC .................................... FAILURE [
> 0.335 s]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 14.392 s
> [INFO] Finished at: 2014-08-26T17:05:37+12:00
> [INFO] Final Memory: 47M/114M
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.eclipse.tycho:tycho-surefire-plugin:0.21.0:test (default-test) on
> project lab.poc.unittests.app.tests: Execution default-test of goal
> org.eclipse.tycho:tycho-surefire-plugin:0.21.0:test failed: No solution
> found because the problem is unsatisfiable.: [Unable to satisfy
> dependency from tycho-extra-1409029537154 0.0.0.1409029537154 to
> lab.poc.unittests.app.feature.feature.group 0.0.0.; Unable to satisfy
> dependency from tycho-1409029537177 0.0.0.1409029537177 to
> lab.poc.unittests.app.feature.feature.group 0.0.0.; No solution found
> because the problem is unsatisfiable.] -> [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/PluginExecutionException
> [ERROR]
> [ERROR] After correcting the problems, you can resume the build with the
> command
> [ERROR] mvn <goals> -rf :lab.poc.unittests.app.tests
>
>
> In the end, as the e(fx)clipse uses a different target platform, I'm not
> even sure if this is right approach to test an e4 + e(fx)clipse project.
> How are you guys doing this?
>
>
> [1]: http://www.vogella.com/tutorials/Eclipse4Testing/article.html
> [2]: https://wiki.eclipse.org/Tycho/Packaging_Types#eclipse-test-plugin
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03635 seconds