Try using the surefire plugin runOrder parameter . This is not like what it has ${expression}, allowing you to change the property from the command line, so I would make my own:
... POM stuff here....
<properties>
<surefire.test.runOrder>filesystem</surefire.test.runOrder>
</properties>
....
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<runOrder>${surefire.test.runOrder}</runOrder>
</configuration>
</plugin>
....
Then you can select the desired option on the command line:
mvn -Dsurefire.test.runOrder=failedfirst test(or packageor any desired step).
source
share