[
https://issues.apache.org/jira/browse/SUREFIRE-1651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16800495#comment-16800495
]
Torsten Mingers edited comment on SUREFIRE-1651 at 3/25/19 9:10 AM:
--------------------------------------------------------------------
I created a small project wich reflects the behavior.
h1. Setup
- All tests are pure JUnit4 tests
- In _maven-surefire-plugin_all tests in the category "IntegrationTest" are
excluded.
- There is a profile _integrationtest_ wich includes all tests in the category
"IntegrationTest" from _maven-failsafe-plugin_
- There are dependency configurations for JUnit4 and JUnit5 (incl. Vintage) to
be activated / deactivated for testing purposes
h2. Tests
h3. JUnit4, just Unit-Tests
*Prerequisite*: disable all JUnit5 dependencies in pom.xml
- call _MVN clean verify_
-- (/) no Unit-Tests are performed by surefire
-- (/) 2 Integration-Tests are performed by failsafe
h3. JUnit4, Integrationtests
*Prerequisite*: disable all JUnit5 dependencies in pom.xml
- call _MVN clean verify -DintegrationTest_
-- (/) 2 Unit-Tests are performed by surefire
-- (/) no Integration-Tests are performed by failsafe
h3. JUnit5, just Unit-Tests
*Prerequisite*: disable all JUnit5 dependencies in pom.xml
- call _MVN clean verify_
-- (/) 2 Unit-Tests are performed by surefire
-- (x) 2 Integration-Tests are performed by failsafe
-- --> These tests should not have been performed
h3. JUnit5, Integrationtests
*Prerequisite*: disable all JUnit5 dependencies in pom.xml
- call _MVN clean verify -DintegrationTest_
-- (/) 2 Unit-Tests are performed by surefire
-- (/) 2 Integration-Tests are performed by failsafe
was (Author: tmi):
I created a small project wich reflects the behavior.
h1. Setup
- All tests are pure JUnit4 tests
- In _maven-surefire-plugin_all tests in the category "IntegrationTest" are
excluded.
- There is a profile _integrationtest_ wich includes all tests in the category
"IntegrationTest" from _maven-failsafe-plugin_
- There are dependency configurations for JUnit4 and JUnit5 (incl. Vintage) to
be activated / deactivated for testing purposes
h2. Tests
h3. Just JUnit4
*Prerequisite*: disable all JUnit5 dependencies in pom.xml
- call _MVN clean verify -DintegrationTest
-- (/) 2 Unit-Tests are performed by surefire
> 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
>
> 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
(v7.6.3#76005)