I have a multi module project with a plugin and fragment to test this plugin. The build is done through maven/tycho. Maven v.3.8.4 and Tycho v2.6.0.
In the fragment I have 3 Unit and 1 Integration test, in the test folder:
test
├── CoreTestConstants.java
├── CoreUtils2Test.java
├── CoreUtils3Test.java
├── CoreUtilsIT.java
└── CoreUtilsTest.java
This is the pom of the fragment plugin:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>4.0.0</modelVersion>
<artifactId>com.tycho.rcp.core.test</artifactId>
<version>0.2.4-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<parent>
<groupId>com.tycho</groupId>
<artifactId>com.tycho.mps</artifactId>
<version>0.3.4-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<executions>
<execution>
<id>it-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
<configuration>
<testSourceDirectory>src</testSourceDirectory>
<testClassesDirectory>target/classes</testClassesDirectory>
<!-- workspace directory -->
<osgiDataDirectory>${mas.test.workspace}</osgiDataDirectory>
<!-- system properties -->
<systemProperties>
<mas.test.archive_location>${mas.test.archive_location}</mas.test.archive_location>
</systemProperties>
<!-- add slf4j implementation dependency from Orbit -->
<dependencies>
<dependency>
<groupId>org.eclipse.orbit.bundles</groupId>
<artifactId>ch.qos.logback.slf4j</artifactId>
<version>1.1.2</version>
<type>eclipse-plugin</type>
</dependency>
</dependencies>
</configuration>
</plugin>
</plugins>
</build>
</project>
The tycho-surefire-plugin is enabled in pluginManagement of the parent project:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
</plugin>
The 3 Unit test are executed correctly, but the IT test is never run!
This is the relevant part of the output, when I run mvn clean verify
inside the fragment project:
[INFO] --- tycho-surefire-plugin:2.6.0:test (default-test) @ com.marchesini.mas.rcp.core.test ---
[INFO] Executing Test Runtime with timeout 0, logs (if any) will be placed at: /home/gionata/runtime-EclipseApplication/.metadata/.log
[INFO] Command line:
[/usr/lib/jvm/java-11-openjdk-11.0.9.11-0.fc31.x86_64/bin/java, -Dosgi.noShutdown=false, -Dosgi.os=linux, -Dosgi.ws=gtk, -Dosgi.arch=x86_64, -Dosgi.clean=true, -Dmas.test.archive_location=/home/gionata/ARCHIVIO.BLK, -jar, /home/gionata/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.5.100.v20180827-1352/org.eclipse.equinox.launcher-1.5.100.v20180827-1352.jar, -data, /home/gionata/runtime-EclipseApplication, -install, /home/gionata/Workspace_Eclipse_Maven/MAS/MPS/com.marchesini.mas.rcp.core.test/target/work, -configuration, /home/gionata/Workspace_Eclipse_Maven/MAS/MPS/com.marchesini.mas.rcp.core.test/target/work/configuration, -application, org.eclipse.tycho.surefire.osgibooter.headlesstest, -testproperties, /home/gionata/Workspace_Eclipse_Maven/MAS/MPS/com.marchesini.mas.rcp.core.test/target/surefire.properties]
Running com.marchesini.mas.rcp.core.test.CoreUtils2Test
Logger launcher start...4
2022-02-05 18:36:11,221 DEBUG [main]: CHECKSUM 2 = 340351cde832c00505c88f3fe1a962d4
2022-02-05 18:36:11,442 DEBUG [main]: Workspace = /home/gionata/runtime-EclipseApplication
2022-02-05 18:36:11,442 DEBUG [main]: Archive location = /home/gionata/ARCHIVIO.BLK
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.569 s - in com.marchesini.mas.rcp.core.test.CoreUtils2Test
testCoreUtils2(com.marchesini.mas.rcp.core.test.CoreUtils2Test) Time elapsed: 0.226 s
Running com.marchesini.mas.rcp.core.test.CoreUtilsTest
#################################################################################
REPORT
CHECKSUM = 340351cde832c00505c88f3fe1a962d4
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 s - in com.marchesini.mas.rcp.core.test.CoreUtilsTest
testCoreUtils(com.marchesini.mas.rcp.core.test.CoreUtilsTest) Time elapsed: 0.002 s
Running com.marchesini.mas.rcp.core.test.CoreUtils3Test
Logger launcher start...4
2022-02-05 18:36:11,537 DEBUG [main]: CHECKSUM 3 = 340351cde832c00505c88f3fe1a962d4
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 s - in com.marchesini.mas.rcp.core.test.CoreUtils3Test
testCoreUtils3(com.marchesini.mas.rcp.core.test.CoreUtils3Test) Time elapsed: 0.001 s
Results:
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO] All tests passed!
[INFO]
[INFO] --- tycho-surefire-plugin:2.6.0:integration-test (it-test) @ com.marchesini.mas.rcp.core.test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
The execution it-test simply doesn't run anything! I have been wasting hours on this....
Thankyou for any help.
CodePudding user response:
First of all, you shouldn't add any specific configuration if you follow the default conventions. Moreover, parameters like <testSourceDirectory>src</testSourceDirectory>
are not read by the tycho surefire plugin. Moreover, there's no need to create products or features for what you need. The reason why it's not working it's because of a bug:
https://github.com/eclipse/tycho/issues/643
On a side note, I've updated the RELEASE notes https://github.com/eclipse/tycho/pull/641 trying to document better the rationale behind the new goal (but, again, it does not work due to a bug)