[
https://issues.apache.org/jira/browse/SUREFIRE-2018?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17495118#comment-17495118
]
Tibor Digana commented on SUREFIRE-2018:
----------------------------------------
[~puchengyang]
If you use JUnit5 Vintage engine, the JUnit4 tests will be executed.
Pls notice that the TestNG is able to execute JUnit tests as well.
You can instruct the TestNG to ignore its own intrisic JUnit execution by
setting the system property {{junit=false}}, see
https://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html
This is too heavy combination, therefore I said to read the documentation
because there is a JUnit5 dependency which is able to run TestNG within JUnit5
engine.
https://repo1.maven.org/maven2/com/github/testng-team/testng-junit5/
https://github.com/apache/maven-surefire/tree/master/surefire-its/src/test/resources/junit5-testng
> Tests not excluded when dependency label used within the plugin
> ---------------------------------------------------------------
>
> Key: SUREFIRE-2018
> URL: https://issues.apache.org/jira/browse/SUREFIRE-2018
> Project: Maven Surefire
> Issue Type: Bug
> Components: Maven Surefire Plugin
> Affects Versions: 3.0.0-M5
> Reporter: Pucheng Yang
> Priority: Major
>
> Hi there, I found a strange issue for me, not sure if it is a bug or I did
> something wrong. Could you help me take a look? thanks.
> I am trying to exclude a test when working on a open source project
> (https://github.com/trinodb/trino/blob/master/core/trino-main/pom.xml#L489),
> here is the original plugin definition
> {code:java}
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <dependencies>
> <!-- allow both JUnit and TestNG -->
> <dependency>
> <groupId>org.apache.maven.surefire</groupId>
> <artifactId>surefire-junit-platform</artifactId>
> <version>${dep.plugin.surefire.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.maven.surefire</groupId>
> <artifactId>surefire-testng</artifactId>
> <version>${dep.plugin.surefire.version}</version>
> </dependency>
> </dependencies>
> </plugin> {code}
> to exclude certain tests, this is what I do
> {code:java}
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <dependencies>
> <!-- allow both JUnit and TestNG -->
> <dependency>
> <groupId>org.apache.maven.surefire</groupId>
> <artifactId>surefire-junit-platform</artifactId>
> <version>${dep.plugin.surefire.version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.maven.surefire</groupId>
> <artifactId>surefire-testng</artifactId>
> <version>${dep.plugin.surefire.version}</version>
> </dependency>
> </dependencies>
> <configuration>
> <excludes>
> <exclude>**/TestFileSingleStreamSpillerFactory.java</exclude>
> </excludes>
> </configuration>
> </plugin>{code}
> However, when I run maven test, this test is not excluded. I tried commented
> out the dependency part, and I can exclude it.
> {code:java}
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <!-- <dependencies>-->
> <!-- <!– allow both JUnit and TestNG
> –>-->
> <!-- <dependency>-->
> <!-- <groupId>org.apache.maven.surefire</groupId>-->
> <!--
> <artifactId>surefire-junit-platform</artifactId>-->
> <!--
> <version>${dep.plugin.surefire.version}</version>-->
> <!-- </dependency>-->
> <!-- <dependency>-->
> <!-- <groupId>org.apache.maven.surefire</groupId>-->
> <!-- <artifactId>surefire-testng</artifactId>-->
> <!--
> <version>${dep.plugin.surefire.version}</version>-->
> <!-- </dependency>-->
> <!-- </dependencies>-->
> <configuration>
> <excludes>
>
> <exclude>**/TestFileSingleStreamSpillerFactory.java</exclude>
> </excludes>
> </configuration>
> </plugin> {code}
> I wonder did I miss something? thanks.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)