I have an application that was executing TestNG tests perfectly with maven, for example, when using a mvn clean install
command.
Currently I have updated the application to start using Spring Boot 3.1.0, and now the tests are completely ignored. No tests are executed.
I am using a classic testng.xml
file defined on the maven-surefire-plugin
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
All solutions I have found are related about the java classes ending on *Test.java
but this is not applied as I am using the testng suite file. And before the update, the tests are working fine.
What has been changed into Spring Boot 3 to skip my tests?
Ok, I have found the "issue". Seems that the new versions of maven-surefire-plugin
needs to include a surefire-testng
extra plugin for executing it:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
</plugin>
After including the dependency on the plugin, now is working fine.