You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tibor Digana (Jira)" <ji...@apache.org> on 2022/03/31 19:26:00 UTC
[jira] [Comment Edited] (SUREFIRE-1651) JUnit5 Vintage + Maven-Failsafe + Category = ???
[ https://issues.apache.org/jira/browse/SUREFIRE-1651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17515533#comment-17515533 ]
Tibor Digana edited comment on SUREFIRE-1651 at 3/31/22 7:25 PM:
-----------------------------------------------------------------
I used the version {{3.0.0-M6}} but also I used the original versions, and I have to say that the project works for me, pls see my logs below.
{{mvn verify -P integrationtest}}
The groups are documented in https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html#Filtering_by_Tags
These groups are transparent to the platform engine. Surefire does not distinguish between engines. Surefire Provider does not know if you use Jupiter or Vintage or any other engine. We only execute the JUnit5 Platform Launcher and the responsibility is finished at this level. Then the Platform Launcher has to pickup engine implementation. The Surefire and Failsafe passed a filter to the Launcher execution and the Surefire Provider only calls execution method of the Launcher by passing certain test class.
Upon this, you should understand that the responsibility for the groups is at the level of junit5 engine implementation. We do not control the execution of the test. We only invoke the execution of the Launcher and we also verify the groups in our integration tests but we do not make any difference between the engines, we are not able to and we do not need it. This means that JUnit5's functionality as tags/groups should be additionally discussed with the Junit team if a bug exists. Sometimes we do it if there are TestNG issues and the TestNG team cooperates with us very well. This is nothing new for us.
{noformat}
[INFO] --- maven-surefire-plugin:3.0.0-M6:test (default-test) @ IntegrationTestJUnit5Vintage ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running net.veda.test.testIntegrationTestIsUnitTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.045 s - in net.veda.test.testIntegrationTestIsUnitTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ IntegrationTestJUnit5Vintage ---
[INFO] Building jar: c:\vcs\IntegrationTestJUnit5Vintage\target\IntegrationTestJUnit5Vintage-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M6:integration-test (default) @ IntegrationTestJUnit5Vintage ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running net.veda.test.testIntegrationTestIsIntegrationTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032 s - in net.veda.test.testIntegrationTestIsIntegrationTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M6:verify (default) @ IntegrationTestJUnit5Vintage ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.981 s
[INFO] Finished at: 2022-03-31T21:08:47+02:00
[INFO] ------------------------------------------------------------------------
{noformat}
was (Author: tibor17):
I used the version {{3.0.0-M6}} but also I used the original versions, and I have to say that the project works for me, pls see my logs below.
{{mvn verify -P integrationtest}}
The groups are documented in https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html#Filtering_by_Tags
These groups are transparent to the platform engine. Surefire does not distinguish between engines. Surefire Provider does not know if you use Jupiter or Vintage or any other engine. We only execute the JUnit5 Platform Launcher and the responsibility is finished at this level. Then the Platform Launcher has to pickup engine implementation.
Surefire and Failsafe passed a filter to the Launcher execution and the Surefire Provider only calls execution method of the Launcher by passing certain test class.
Upon this, you should understand that the responsibility for the groups is at the level of junit5 engine implementation. We do not control the execution of the test. We only invoke the execution of the Launcher and we also verify the groups in our integration tests but we do not make any difference between the engines, we are not able to and we do not need it. This means that JUnit5's functionality as tags/groups should be additionally discussed with the Junit team if a bug exists. Sometimes we do it if there are TestNG issues and the TestNG team cooperates with us very well. This is nothing new for us.
{noformat}
[INFO] --- maven-surefire-plugin:3.0.0-M6:test (default-test) @ IntegrationTestJUnit5Vintage ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running net.veda.test.testIntegrationTestIsUnitTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.045 s - in net.veda.test.testIntegrationTestIsUnitTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ IntegrationTestJUnit5Vintage ---
[INFO] Building jar: c:\vcs\IntegrationTestJUnit5Vintage\target\IntegrationTestJUnit5Vintage-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M6:integration-test (default) @ IntegrationTestJUnit5Vintage ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running net.veda.test.testIntegrationTestIsIntegrationTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.032 s - in net.veda.test.testIntegrationTestIsIntegrationTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M6:verify (default) @ IntegrationTestJUnit5Vintage ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.981 s
[INFO] Finished at: 2022-03-31T21:08:47+02:00
[INFO] ------------------------------------------------------------------------
{noformat}
> JUnit5 Vintage + Maven-Failsafe + Category = ???
> ------------------------------------------------
>
> Key: SUREFIRE-1651
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1651
> Project: Maven Surefire
> Issue Type: Bug
> Components: JUnit 5.x support
> Affects Versions: 2.22.1
> Reporter: Torsten Mingers
> Priority: Major
> Attachments: IntegrationTestJUnit5Vintage.zip
>
>
> I finally managed to switch our test infrastructure to JUnit5. Strictly speaking, it is the first step and the "old" tests are all still JUnit4 and run via the Vintage engine.
> I currently have a problem with this combination.
>
> *Some details:*
> We separate unit tests and integration tests with @Category annotations and then filter them out in Surefire and Failsafe. I'll add the setup below.
> Since the change to JUnit5-Vintage, filtering has stopped working and all tests are always running.
> In JUnit5 the filtering happens via Tags. I can not specify these in JUnit4-based tests.
> According to the JUnit5 documentation, the categories should continue to work: https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4-categories-support
> However, in the documentary of Surefire (or Failsafe) only tags covered: https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html
> The configuration for JUnit5 tags is done in _groups_ as previously with the categories in JUnit4. But the configuration does not seem to work when using JUnit5 Vintage engine to run the tests.
> Is there a way to configure the Maven Failsafe and Surefire plugins to work with tags *and* categories?
> For a hint, I would be very grateful.
>
> *Configuration used*
> {code}<plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <version>2.22.1</version>
> <configuration>
> <includes>
> <include>**/*.class</include>
> </includes>
> <excludedGroups>
> net.veda.horizon.test.IntegrationTest, net.veda.horizon.test.IntegrationTestGraphDB, net.veda.horizon.test.IntegrationPermissionTest
> </excludedGroups>
> </configuration>
> </plugin>
> </plugins>
> ...
> <profiles>
> <profile>
> <id>integrationtest</id>
> <activation>
> <property>
> <name>integrationTest</name>
> </property>
> </activation>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-failsafe-plugin</artifactId>
> <version>2.19.1</version>
> <configuration>
> <includes>
> <include>**/*.java</include>
> </includes>
> <groups>net.veda.horizon.test.IntegrationTest</groups>
> </configuration>
> <executions>
> ...
> </executions>
> </plugin>
> </plugins>
> </build>
> </profile>
> ...
> </profiles>{code}
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)