I have a maven project and several test classes.
I want to run these tests in a specific order with the plug-in surefire.
For example, I have:
I want to run the Class 1, then 2, then 3 and finally 4.
How can I specify this in the pom.xml?
One workaround is to set the runOrder
parameter to alphabetical and then rename your tests to have alphabetical order.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<runOrder>alphabetical</runOrder>
</configuration>
</plugin>
This isn't recommended, though - unit tests should be independent of each other. The execution order shouldn't matter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With