Я пытаюсь повторно запустить неудачные тесты, используя Junit5 и maven-surefire-plugin.
Я попытался передать rerunFailingTestsCount
как свойство, а также как свойство конфигурации в pom.xml.
mvn '-Dsurefire.rerunFailingTestsCount=2' '-Dtest=com.salesforceiq.engagementapis.TestReRun#testfailure' clean test
https://maven.apache.org/surefire-archives/surefire-2.18.1/maven-failsafe-plugin/examples/rerun-failing-tests.html
Но, похоже, неудачные тесты не перезапускаются
Это мой простой тестовый класс
public class TestReRun {
@Test
public void testfailure(){
Assert.assertTrue(false);
}
}
Это pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<rerunFailingTestsCount>2</rerunFailingTestsCount>
<failIfNoTests>false</failIfNoTests>
<useSystemClassLoader>false</useSystemClassLoader>
<perCoreThreadCount>false</perCoreThreadCount>
<forkCount>0</forkCount>
<reuseForks>true</reuseForks>
</configuration>
</plugin>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.2.0-M1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.2.0-M1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.2.0-M1</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-engine</artifactId>
<version>1.2.0-M1</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite-api</artifactId>
<version>1.2.0-M1</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.2.0-M1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.2.0-M1</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.2.0-M1</version>
</dependency>
Фактические результаты:
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.11 s <<< FAILURE! - in com.salesforceiq.engagementapis.TestEngagementFetchAPIs
[ERROR] testfailure Time elapsed: 0.176 s <<< FAILURE!
java.lang.AssertionError
at com.salesforceiq.engagementapis.TestEngagementFetchAPIs.testfailure(TestEngagementFetchAPIs.java:242)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] TestEngagementFetchAPIs.testfailure:242
[INFO]
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.805 s
[INFO] Finished at: 2019-09-21T15:40:15-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test (default-test) on project siqapiautomation: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/nishkam.agrawal/Documents/projects/siqapiautomation/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException```