I try to run a testng suite via maven. This is the plugin within my build dependencies of the pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>test.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
and that the testng dependency:
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.4.0</version>
</dependency>
I would expect that with the command:
mvn clean test
my test.xml is executed. But instead all my unit tests are executed and my test suite is untouched.
In case I change the version of surefire to 2.22.2 and testng 6.10 everything works as expected and the test.xml is used.
How can I fix that with the latest version of surfire and testng?
CodePudding user response:
You fell into Surefire open bug <suiteXmlFiles> no longer finds tests starting with 3.0.0-M4
TestSuite is discovered and the tests are run. This is on Surefire 3.0.0-M3. If you change to 3.0.0-M4 or higher and run the same command, it will not find the TestSuite at all or run any tests.
Downgrade (until it's fixed) to version 3.0.0-M3 (or lower)