Maven 'test' command, which runs only those tests that did not run

Is there a way to invoke the maven 'test' command, which runs only those tests that did not run the last time it was called?

+5
source share
1 answer

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>
    <!-- plugin default value for this param -->  
    <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).

+5
source

All Articles