[ 
https://issues.apache.org/jira/browse/SUREFIRE-2252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17877170#comment-17877170
 ] 

ASF GitHub Bot commented on SUREFIRE-2252:
------------------------------------------

ArvindJoshi-okta commented on code in PR #772:
URL: https://github.com/apache/maven-surefire/pull/772#discussion_r1733467237


##########
surefire-providers/surefire-junit-platform/src/test/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProviderTest.java:
##########
@@ -249,6 +257,34 @@ public void singleTestClassIsInvokedLazily() throws 
Exception {
         assertEquals(TestClass1.TESTS_FAILED, summary.getTestsFailedCount());
     }
 
+    @Test
+    public void multipleTestClassesIsInvokedLazily() throws Exception {

Review Comment:
   ack



##########
surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/JUnitPlatformProvider.java:
##########
@@ -173,15 +173,17 @@ private void invokeAllTests(TestsToRun testsToRun, 
RunListenerAdapter adapter) {
 
     private void execute(TestsToRun testsToRun, RunListenerAdapter adapter) {
         if (testsToRun.allowEagerReading()) {
-            List<DiscoverySelector> selectors = new ArrayList<>();
-            testsToRun.iterator().forEachRemaining(c -> 
selectors.add(selectClass(c.getName())));
+            testsToRun.iterator().forEachRemaining(c -> {
+                List<DiscoverySelector> selectors = new ArrayList<>();
+                selectors.add(selectClass(c.getName()));
 
-            LauncherDiscoveryRequestBuilder builder = request()
-                    .filters(filters)
-                    .configurationParameters(configurationParameters)
-                    .selectors(selectors);
+                LauncherDiscoveryRequestBuilder builder = request()
+                        .filters(filters)
+                        .configurationParameters(configurationParameters)
+                        .selectors(selectors);
 
-            launcher.execute(builder.build(), adapter);
+                launcher.execute(builder.build(), adapter);
+            });

Review Comment:
   Oh you are right, I completely missed that, will clean this up. 





> Failsafe xml for a test class has results from another class
> ------------------------------------------------------------
>
>                 Key: SUREFIRE-2252
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2252
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Failsafe Plugin
>    Affects Versions: 3.2.5, 3.3.1
>         Environment: Maven/JUnit5/Mac
>            Reporter: Arvind Joshi
>            Priority: Blocker
>         Attachments: ClassAIT.java, ClassBIT.java, 
> TEST-org.example.ClassAIT.xml, TEST-org.example.ClassBIT.xml, pom.xml
>
>
> *Issue*
> When I execute tests concurrently (at class level), I see the failsafe xmls 
> being generated, but the test methods themselves seem to be mixed up with 
> other classes.
> *Expectation*
> Each failsafe xml is unique to a class, which was the case with the JUnit4 
> provider.
> *Versions*
> maven failsafe plugin 3.2.5 or 3.3.1
> JUnit 5.10.2
> *Sample code and Test results*
> Please see attached files
> *Running the tests attached*
>  
> {noformat}
> mvn clean verify -Pparallel-tests{noformat}
>  
>  
> {noformat}
> [INFO] -------------------------------------------------------
> [INFO]  T E S T S
> [INFO] -------------------------------------------------------
> [INFO] Running org.example.ClassBIT
> [INFO] Running org.example.ClassAIT
> [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.026 
> s – in org.example.ClassAIT
> [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.026 
> s – in org.example.ClassBIT
> [INFO]
> [INFO] Results:
> [INFO]
> [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to