Tibor17 commented on a change in pull request #245: Surefire-1584: Add option 
to rerun failing tests for JUnit5 
URL: https://github.com/apache/maven-surefire/pull/245#discussion_r315603657
 
 

 ##########
 File path: 
surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProvider.java
 ##########
 @@ -147,7 +149,26 @@ private TestsToRun scanClasspath()
     private void invokeAllTests( TestsToRun testsToRun, RunListener 
runListener )
     {
         LauncherDiscoveryRequest discoveryRequest = 
buildLauncherDiscoveryRequest( testsToRun );
-        launcher.execute( discoveryRequest, new RunListenerAdapter( 
runListener ) );
+        RunListenerAdapter adapter = new RunListenerAdapter( runListener );
+        launcher.execute( discoveryRequest, adapter );
+        // Rerun failing tests if requested
+        int count = parameters.getTestRequest().getRerunFailingTestsCount();
+        if ( count > 0 && adapter.hasFailingTests() )
+        {
+            for ( int i = 0; i < count; i++ )
+            {
+                // Replace the "discoveryRequest" so that it only specifies 
the failing tests
+                discoveryRequest = 
buildLauncherDiscoveryRequestForRerunFailures( adapter );
+                // Reset adapter's recorded failures and invoke the tests again
 
 Review comment:
   Added one word: `// Reset adapter's recorded failures and invoke the failed 
tests again`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to