[GitHub] [maven-surefire] Col-E commented on a change in pull request #245: Surefire-1584: Add option to rerun failing tests for JUnit5
Col-E 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_r330330659 ## File path: surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java ## @@ -47,6 +47,7 @@ implements TestExecutionListener { private final ConcurrentMap testStartTime = new ConcurrentHashMap<>(); +private final ConcurrentMap failures = new ConcurrentHashMap<>(); Review comment: Perhaps associating a test context to the failures would be a sensible solution here. If the `failures` cannot be cleared in `testPlanExecutionFinished` due to them being needed in `JUnitPlatformProvider#invokeAllTests`, how should they be cleared? If done externally by the providers even the providers that don't need the `failures` collection would need to clear them. Any ideas? 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
[GitHub] [maven-surefire] Col-E commented on a change in pull request #245: Surefire-1584: Add option to rerun failing tests for JUnit5
Col-E 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_r330329094 ## File path: surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java ## @@ -60,14 +60,14 @@ public void testPlanExecutionStarted( TestPlan testPlan ) { this.testPlan = testPlan; +failures.clear(); Review comment: Correct. When one test plan finishes and the next starts the failures of the prior execution are cleared. 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
[GitHub] [maven-surefire] Col-E commented on a change in pull request #245: Surefire-1584: Add option to rerun failing tests for JUnit5
Col-E 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_r330129552 ## File path: surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java ## @@ -47,6 +47,7 @@ implements TestExecutionListener { private final ConcurrentMap testStartTime = new ConcurrentHashMap<>(); +private final ConcurrentMap failures = new ConcurrentHashMap<>(); Review comment: Clearing in `testPlanExecutionFinished` doesn't allow the data to be accessible when referenced in `JUnitPlatformProvider#invokeAllTests`. Having it clear per-test in `testPlanExecutionStarted` keeps the expected behavior. Moving the `failures.clear()` as detailed resolves the ITS failures mentioned today: ![image](https://user-images.githubusercontent.com/21371686/65977509-0b4ac480-e440-11e9-8215-ff3a6b5543c9.png) 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
[GitHub] [maven-surefire] Col-E commented on a change in pull request #245: Surefire-1584: Add option to rerun failing tests for JUnit5
Col-E 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_r315820300 ## File path: surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java ## @@ -259,4 +261,50 @@ else if ( testSource.filter( ClassSource.class::isInstance ).isPresent() ) return new String[] { source, source, display, display }; } } + +public String[] toClassMethodNameWithoutPlan( TestIdentifier testIdentifier ) Review comment: Are you referring to `toClassMethodName`? That couldn't be used because at the time of requesting class names for reruns the plan is set to `null`. Perhaps adding a null check in the original method that provides the same logic as what's implemented in this extra method would suffice? Or were you thinking of a different approach? 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
[GitHub] [maven-surefire] Col-E commented on a change in pull request #245: Surefire-1584: Add option to rerun failing tests for JUnit5
Col-E 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_r315834218 ## File path: surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformRerunFailingTestsIT.java ## @@ -0,0 +1,268 @@ +package org.apache.maven.surefire.its; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.its.fixture.OutputValidator; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.apache.maven.surefire.its.fixture.SurefireLauncher; +import org.junit.Test; + +/** + * JUnit4 RunListener Integration Test. + * + * @author mailto:qingzhou...@google.com";>Qingzhou Luo + * @author Matt Coley + */ +public class JUnitPlatformRerunFailingTestsIT extends SurefireJUnit4IntegrationTestCase +{ +private final static String GOAL = "-Dprovider=surefire-junit-platform"; +private final static String VERSION = "5.4.2"; Review comment: Testing on `5.5.1` and removing the explicit provider goal yields a _BUILD SUCCESS_ :+1: 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
[GitHub] [maven-surefire] Col-E commented on a change in pull request #245: Surefire-1584: Add option to rerun failing tests for JUnit5
Col-E 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_r315820300 ## File path: surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java ## @@ -259,4 +261,50 @@ else if ( testSource.filter( ClassSource.class::isInstance ).isPresent() ) return new String[] { source, source, display, display }; } } + +public String[] toClassMethodNameWithoutPlan( TestIdentifier testIdentifier ) Review comment: Are you referring to `toClassMethodName`? That couldn't be used because at the time of requesting class names for reruns the plan is set to `null`. Perhaps a null check in the original method would suffice or were you thinking of a different approach? 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