You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2015/05/02 11:56:35 UTC
[01/10] maven-surefire git commit: [SUREFIRE-1152] Support
rerunFailingTestsCount for test suites Submitted by: Sean Flanigan
Repository: maven-surefire
Updated Branches:
refs/heads/master 710a3d58d -> 5c3a3138e
[SUREFIRE-1152] Support rerunFailingTestsCount for test suites
Submitted by: Sean Flanigan
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/cb977633
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/cb977633
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/cb977633
Branch: refs/heads/master
Commit: cb977633f0f1d2be4b2556a4743a5f52d8a7008a
Parents: 1f19156
Author: Sean Flanigan <sf...@redhat.com>
Authored: Sat Apr 11 11:32:37 2015 +1000
Committer: Sean Flanigan <sf...@redhat.com>
Committed: Sat Apr 11 11:47:33 2015 +1000
----------------------------------------------------------------------
.../Surefire1152RerunFailingTestsInSuiteIT.java | 42 +++++++++
.../pom.xml | 91 ++++++++++++++++++++
.../test/java/jiras/surefire1152/FlakyIT.java | 35 ++++++++
.../java/jiras/surefire1152/FlakyITSuite.java | 28 ++++++
.../test/java/jiras/surefire1152/FlakyTest.java | 35 ++++++++
.../java/jiras/surefire1152/FlakyTestSuite.java | 28 ++++++
.../common/junit4/JUnit4ProviderUtil.java | 10 +--
.../maven/surefire/junit4/JUnit4Provider.java | 20 +++--
8 files changed, 279 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb977633/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
new file mode 100644
index 0000000..7385b22
--- /dev/null
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
@@ -0,0 +1,42 @@
+package org.apache.maven.surefire.its.jiras;
+
+/*
+ * 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.junit.Test;
+
+/**
+ * SUREFIRE-1152 Assert rerunFailingTestsCount works with test suites
+ *
+ * @author Sean Flanigan
+ */
+public class Surefire1152RerunFailingTestsInSuiteIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+
+ @Test
+ public void rerunsFailingTestInSuite()
+ {
+ OutputValidator outputValidator = unpack( "surefire-1152-rerunFailingTestsCount-suite" ).executeVerify();
+ outputValidator.assertTestSuiteResults( 1, 0, 0, 0 );
+ outputValidator.assertIntegrationTestSuiteResults( 1, 0, 0, 0 );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb977633/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml
new file mode 100644
index 0000000..b0206b7
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>it-parent</artifactId>
+ <version>1.0</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <groupId>org.apache.maven.plugins.surefire</groupId>
+ <artifactId>jiras-surefire-1152</artifactId>
+
+ <version>1.0</version>
+
+ <properties>
+ <failIfNoTests>true</failIfNoTests>
+ <failsafe.rerunFailingTestsCount>2</failsafe.rerunFailingTestsCount>
+ <surefire.rerunFailingTestsCount>2</surefire.rerunFailingTestsCount>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/FlakyTestSuite.java</include>
+ </includes>
+ <!--<skip>true</skip>-->
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <includes>
+ <include>**/FlakyITSuite.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb977633/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyIT.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyIT.java
new file mode 100644
index 0000000..54888db
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyIT.java
@@ -0,0 +1,35 @@
+package jiras.surefire1152;
+
+/*
+ * 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.junit.Test;
+
+public class FlakyIT {
+
+ static int n = 0;
+
+ @Test
+ public void testFlaky() {
+ if (n++ == 0) {
+ throw new AssertionError("deliberately flaky test (should pass the next time)");
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb977633/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyITSuite.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyITSuite.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyITSuite.java
new file mode 100644
index 0000000..77d1c9f
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyITSuite.java
@@ -0,0 +1,28 @@
+package jiras.surefire1152;
+
+/*
+ * 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.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({FlakyIT.class})
+public class FlakyITSuite {
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb977633/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
new file mode 100644
index 0000000..613b7df
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
@@ -0,0 +1,35 @@
+package jiras.surefire1152;
+
+/*
+ * 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.junit.Test;
+
+public class FlakyTest {
+
+ static int n = 0;
+
+ @Test
+ public void testFlaky() {
+ if (n++ == 0) {
+ throw new AssertionError("deliberately flaky test (should pass the next time)");
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb977633/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
new file mode 100644
index 0000000..09e100b
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
@@ -0,0 +1,28 @@
+package jiras.surefire1152;
+
+/*
+ * 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.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({FlakyTest.class})
+public class FlakyTestSuite {
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb977633/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
----------------------------------------------------------------------
diff --git a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
index 610ac2c..1e35552 100644
--- a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
+++ b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
@@ -90,14 +90,14 @@ public final class JUnit4ProviderUtil
}
/**
- * Get the name of all test methods from a list of Failures
+ * Get all test methods from a list of Failures
*
* @param allFailures the list of failures for a given test class
- * @return the list of test method names
+ * @return the list of test methods
*/
- public static Set<String> generateFailingTests( List<Failure> allFailures )
+ public static Set<ClassMethod> generateFailingTests( List<Failure> allFailures )
{
- Set<String> failingMethods = new HashSet<String>();
+ Set<ClassMethod> failingMethods = new HashSet<ClassMethod>();
for ( Failure failure : allFailures )
{
@@ -107,7 +107,7 @@ public final class JUnit4ProviderUtil
ClassMethod classMethod = cutTestClassAndMethod( description );
if ( classMethod.isValid() )
{
- failingMethods.add( classMethod.getMethod() );
+ failingMethods.add( classMethod );
}
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/cb977633/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java b/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
index 12c3983..b622aea 100644
--- a/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
+++ b/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
@@ -171,11 +171,12 @@ public class JUnit4Provider
{
for ( int i = 0; i < rerunFailingTestsCount && !failureListener.getAllFailures().isEmpty(); i++ )
{
- Set<String> failedTests = JUnit4ProviderUtil.generateFailingTests( failureListener.getAllFailures() );
+ Set<ClassMethod> failedTests = JUnit4ProviderUtil.generateFailingTests(
+ failureListener.getAllFailures( ) );
failureListener.reset();
if ( !failedTests.isEmpty() )
{
- executeFailedMethod( clazz, listeners, failedTests );
+ executeFailedMethod( listeners, failedTests );
}
}
}
@@ -273,11 +274,20 @@ public class JUnit4Provider
}
}
- private static void executeFailedMethod( Class<?> testClass, RunNotifier notifier, Set<String> failedMethods )
+ private void executeFailedMethod( RunNotifier notifier, Set<ClassMethod> failedMethods )
{
- for ( String failedMethod : failedMethods )
+ for ( ClassMethod failedMethod : failedMethods )
{
- Request.method( testClass, failedMethod ).getRunner().run( notifier );
+ try
+ {
+ Class<?> methodClass = Class.forName( failedMethod.getClazz(), true, testClassLoader );
+ String methodName = failedMethod.getMethod();
+ Request.method( methodClass, methodName ).getRunner().run( notifier );
+ }
+ catch ( ClassNotFoundException e )
+ {
+ throw new RuntimeException( "Unable to create test class '" + failedMethod.getClazz() + "'", e );
+ }
}
}
[05/10] maven-surefire git commit: Check that inherited tests in
suites are rerun correctly
Posted by ti...@apache.org.
Check that inherited tests in suites are rerun correctly
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/8cf6e575
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/8cf6e575
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/8cf6e575
Branch: refs/heads/master
Commit: 8cf6e57536eea65240d13114a8bcdd400f55770b
Parents: 62aa798
Author: Sean Flanigan <sf...@redhat.com>
Authored: Thu Apr 16 16:57:06 2015 +1000
Committer: Sean Flanigan <sf...@redhat.com>
Committed: Tue Apr 28 14:25:07 2015 +1000
----------------------------------------------------------------------
.../java/jiras/surefire1152/FlakyParent.java | 45 ++++++++++++++++++++
.../test/java/jiras/surefire1152/FlakyTest.java | 2 +-
.../java/jiras/surefire1152/FlakyTestSuite.java | 2 +-
3 files changed, 47 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8cf6e575/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyParent.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyParent.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyParent.java
new file mode 100644
index 0000000..86a08db
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyParent.java
@@ -0,0 +1,45 @@
+package jiras.surefire1152;
+
+/*
+ * 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.junit.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.junit.Assert.fail;
+
+public class FlakyParent
+{
+ // set of test classes which have previously invoked testFlakyParent
+ private static final Set<Class<?>> previouslyRun = new HashSet<Class<?>>();
+
+ @Test
+ public void testFlakyParent()
+ {
+ Class<?> clazz = getClass();
+ if ( !previouslyRun.contains( clazz ) )
+ {
+ previouslyRun.add( clazz );
+ fail( "deliberately flaky test (should pass the next time)" );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8cf6e575/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
index cab834c..ee20f9e 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
@@ -23,7 +23,7 @@ import org.junit.Test;
import static org.junit.Assert.fail;
-public class FlakyTest
+public class FlakyTest extends FlakyParent
{
private static int n;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8cf6e575/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
index 85ec1b3..f4a7d67 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
@@ -23,7 +23,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith( Suite.class )
-@Suite.SuiteClasses( { FlakyTest.class } )
+@Suite.SuiteClasses( { FlakyTest.class, FlakyParent.class } )
public class FlakyTestSuite
{
}
[06/10] maven-surefire git commit: Support rerunFailingTestsCount for
JUnit 4.7 test suites
Posted by ti...@apache.org.
Support rerunFailingTestsCount for JUnit 4.7 test suites
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/7552ea92
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/7552ea92
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/7552ea92
Branch: refs/heads/master
Commit: 7552ea926a2df2869aead38a52f4bad49acaea8c
Parents: 8cf6e57
Author: Sean Flanigan <sf...@redhat.com>
Authored: Tue Apr 28 14:29:09 2015 +1000
Committer: Sean Flanigan <sf...@redhat.com>
Committed: Tue Apr 28 14:29:09 2015 +1000
----------------------------------------------------------------------
.../Surefire1152RerunFailingTestsInSuiteIT.java | 27 ++++++++-
.../pom.xml | 61 ++++++++++++++++++++
.../common/junit4/JUnit4ProviderUtil.java | 44 ++++++--------
.../common/junit4/JUnit4ProviderUtilTest.java | 8 +--
.../surefire/junitcore/JUnitCoreProvider.java | 2 +-
5 files changed, 108 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7552ea92/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
index c17c661..e0bc7de 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
@@ -21,6 +21,7 @@ package org.apache.maven.surefire.its.jiras;
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;
/**
@@ -31,12 +32,32 @@ import org.junit.Test;
public class Surefire1152RerunFailingTestsInSuiteIT
extends SurefireJUnit4IntegrationTestCase
{
+ private static final String RUNNING_WITH_JUNIT48 =
+ "Using configured provider org.apache.maven.surefire.junitcore.JUnitCoreProvider";
- @Test
- public void rerunsFailingTestInSuite()
+ public OutputValidator runMethodPattern( String projectName, String... goals )
{
- OutputValidator outputValidator = unpack( "surefire-1152-rerunFailingTestsCount-suite" ).executeVerify();
+ SurefireLauncher launcher = unpack( projectName );
+ for ( String goal : goals )
+ {
+ launcher.addGoal( goal );
+ }
+ OutputValidator outputValidator = launcher.executeTest();
outputValidator.assertTestSuiteResults( 3, 0, 0, 0, 3 );
outputValidator.assertIntegrationTestSuiteResults( 1, 0, 0, 0 );
+ return outputValidator;
+ }
+
+ @Test
+ public void testJUnit48Provider4()
+ {
+ runMethodPattern( "surefire-1152-rerunFailingTestsCount-suite", "-P surefire-junit4" );
}
+
+ @Test
+ public void testJUnit48Provider47()
+ {
+ runMethodPattern( "surefire-1152-rerunFailingTestsCount-suite", "-P surefire-junit47" ).verifyTextInLog( RUNNING_WITH_JUNIT48 );
+ }
+
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7552ea92/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml
index 5719efd..fd11c14 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml
@@ -78,6 +78,67 @@
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>surefire-junit47</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit47</artifactId>
+ <version>${surefire.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit47</artifactId>
+ <version>${surefire.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>surefire-junit4</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit4</artifactId>
+ <version>${surefire.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-junit4</artifactId>
+ <version>${surefire.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7552ea92/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
----------------------------------------------------------------------
diff --git a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
index 1e35552..6861a21 100644
--- a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
+++ b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
@@ -19,8 +19,6 @@ package org.apache.maven.surefire.common.junit4;
* under the License.
*/
-import org.apache.maven.surefire.util.TestsToRun;
-
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -28,6 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.maven.surefire.testset.TestSetFailedException;
import org.apache.maven.surefire.util.internal.StringUtils;
import org.junit.runner.Description;
@@ -52,38 +51,31 @@ public final class JUnit4ProviderUtil
* Organize all the failures in previous run into a map between test classes and corresponding failing test methods
*
* @param allFailures all the failures in previous run
- * @param testsToRun all the test classes
+ * @param testClassLoader ClassLoader used for test classes
* @return a map between failing test classes and their corresponding failing test methods
*/
- public static Map<Class<?>, Set<String>> generateFailingTests( List<Failure> allFailures, TestsToRun testsToRun )
+ public static Map<Class<?>, Set<String>> generateFailingTests( List<Failure> allFailures,
+ ClassLoader testClassLoader )
+ throws TestSetFailedException
{
Map<Class<?>, Set<String>> testClassMethods = new HashMap<Class<?>, Set<String>>();
-
- for ( Failure failure : allFailures )
+ Set<ClassMethod> failingTests = generateFailingTests( allFailures );
+ for ( ClassMethod classMethod: failingTests )
{
- Description description = failure.getDescription();
- if ( description.isTest() && !isFailureInsideJUnitItself( description ) )
+ try
{
- ClassMethod classMethod = cutTestClassAndMethod( description );
- if ( classMethod.isValid() )
+ Class testClassObj = Class.forName( classMethod.getClazz(), true, testClassLoader );
+ Set<String> failingMethods = testClassMethods.get( testClassObj );
+ if ( failingMethods == null )
{
- Class testClassObj = testsToRun.getClassByName( classMethod.getClazz() );
-
- if ( testClassObj != null )
- {
- Set<String> failingMethods = testClassMethods.get( testClassObj );
- if ( failingMethods == null )
- {
- failingMethods = new HashSet<String>();
- failingMethods.add( classMethod.getMethod() );
- testClassMethods.put( testClassObj, failingMethods );
- }
- else
- {
- failingMethods.add( classMethod.getMethod() );
- }
- }
+ failingMethods = new HashSet<String>();
+ testClassMethods.put( testClassObj, failingMethods );
}
+ failingMethods.add( classMethod.getMethod() );
+ }
+ catch ( ClassNotFoundException e )
+ {
+ throw new TestSetFailedException( "Unable to create test class '" + classMethod.getClazz() + "'", e );
}
}
return testClassMethods;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7552ea92/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtilTest.java
----------------------------------------------------------------------
diff --git a/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtilTest.java b/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtilTest.java
index f4fdc95..6a6e2e7 100644
--- a/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtilTest.java
+++ b/surefire-providers/common-junit4/src/test/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtilTest.java
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.common.junit4;
*/
import junit.framework.TestCase;
+import org.apache.maven.surefire.testset.TestSetFailedException;
import org.apache.maven.surefire.util.TestsToRun;
import org.junit.runner.Description;
import org.junit.runner.notification.Failure;
@@ -39,9 +40,8 @@ import static org.apache.maven.surefire.common.junit4.JUnit4ProviderUtil.*;
public class JUnit4ProviderUtilTest
extends TestCase
{
- public void testGenerateFailingTests()
+ public void testGenerateFailingTests() throws TestSetFailedException
{
- TestsToRun testsToRun = new TestsToRun( Arrays.asList( new Class[]{ T1.class, T2.class } ) );
List<Failure> failures = new ArrayList<Failure>( );
Description test1Description = Description.createTestDescription( T1.class, "testOne" );
@@ -56,7 +56,7 @@ public class JUnit4ProviderUtilTest
failures.add( new Failure( test4Description, new AssertionError() ) );
failures.add( new Failure( test5Description, new RuntimeException() ) );
- Map<Class<?>, Set<String>> result = generateFailingTests( failures, testsToRun );
+ Map<Class<?>, Set<String>> result = generateFailingTests( failures, getClass().getClassLoader() );
assertEquals( 2, result.size() );
Set<String> resultForT1 = result.get( T1.class );
@@ -108,4 +108,4 @@ public class JUnit4ProviderUtilTest
{
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7552ea92/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
index 3276b4e..bc2dd3b 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
@@ -147,7 +147,7 @@ public class JUnitCoreProvider
for ( int i = 0; i < rerunFailingTestsCount && !testFailureListener.getAllFailures().isEmpty(); i++ )
{
Map<Class<?>, Set<String>> failingTests =
- JUnit4ProviderUtil.generateFailingTests( testFailureListener.getAllFailures(), testsToRun );
+ JUnit4ProviderUtil.generateFailingTests( testFailureListener.getAllFailures(), testClassLoader );
testFailureListener.reset();
final FilterFactory filterFactory = new FilterFactory( testClassLoader );
Filter failingMethodsFilter = filterFactory.createFailingMethodFilter( failingTests );
[02/10] maven-surefire git commit: Add review changes requested by
Tibor Digana
Posted by ti...@apache.org.
Add review changes requested by Tibor Digana
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/a561181a
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/a561181a
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/a561181a
Branch: refs/heads/master
Commit: a561181a0414f62244b63ab78ea7488bb1e9b2e7
Parents: cb97763
Author: Sean Flanigan <sf...@redhat.com>
Authored: Mon Apr 13 11:03:36 2015 +1000
Committer: Sean Flanigan <sf...@redhat.com>
Committed: Mon Apr 13 11:03:36 2015 +1000
----------------------------------------------------------------------
.../pom.xml | 5 ++---
.../src/test/java/jiras/surefire1152/FlakyIT.java | 14 +++++++++-----
.../test/java/jiras/surefire1152/FlakyITSuite.java | 7 ++++---
.../src/test/java/jiras/surefire1152/FlakyTest.java | 14 +++++++++-----
.../test/java/jiras/surefire1152/FlakyTestSuite.java | 7 ++++---
.../apache/maven/surefire/junit4/JUnit4Provider.java | 5 +++--
6 files changed, 31 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a561181a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml
index b0206b7..5719efd 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/pom.xml
@@ -26,7 +26,6 @@
<groupId>org.apache.maven.surefire</groupId>
<artifactId>it-parent</artifactId>
<version>1.0</version>
- <relativePath>../pom.xml</relativePath>
</parent>
<groupId>org.apache.maven.plugins.surefire</groupId>
<artifactId>jiras-surefire-1152</artifactId>
@@ -53,7 +52,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
- <include>**/FlakyTestSuite.java</include>
+ <include>FlakyTestSuite</include>
</includes>
<!--<skip>true</skip>-->
</configuration>
@@ -72,7 +71,7 @@
</executions>
<configuration>
<includes>
- <include>**/FlakyITSuite.java</include>
+ <include>FlakyITSuite</include>
</includes>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a561181a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyIT.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyIT.java
index 54888db..27d5b5f 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyIT.java
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyIT.java
@@ -21,14 +21,18 @@ package jiras.surefire1152;
import org.junit.Test;
-public class FlakyIT {
+import static org.junit.Assert.fail;
- static int n = 0;
+public class FlakyIT
+{
+ private static int n;
@Test
- public void testFlaky() {
- if (n++ == 0) {
- throw new AssertionError("deliberately flaky test (should pass the next time)");
+ public void testFlaky()
+ {
+ if ( n++ == 0 )
+ {
+ fail( "deliberately flaky test (should pass the next time)" );
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a561181a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyITSuite.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyITSuite.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyITSuite.java
index 77d1c9f..0ebd03c 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyITSuite.java
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyITSuite.java
@@ -22,7 +22,8 @@ package jiras.surefire1152;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
-@RunWith(Suite.class)
-@Suite.SuiteClasses({FlakyIT.class})
-public class FlakyITSuite {
+@RunWith( Suite.class )
+@Suite.SuiteClasses( { FlakyIT.class } )
+public class FlakyITSuite
+{
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a561181a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
index 613b7df..cab834c 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
@@ -21,14 +21,18 @@ package jiras.surefire1152;
import org.junit.Test;
-public class FlakyTest {
+import static org.junit.Assert.fail;
- static int n = 0;
+public class FlakyTest
+{
+ private static int n;
@Test
- public void testFlaky() {
- if (n++ == 0) {
- throw new AssertionError("deliberately flaky test (should pass the next time)");
+ public void testFlaky()
+ {
+ if ( n++ == 0 )
+ {
+ fail( "deliberately flaky test (should pass the next time)" );
}
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a561181a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
index 09e100b..85ec1b3 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
@@ -22,7 +22,8 @@ package jiras.surefire1152;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
-@RunWith(Suite.class)
-@Suite.SuiteClasses({FlakyTest.class})
-public class FlakyTestSuite {
+@RunWith( Suite.class )
+@Suite.SuiteClasses( { FlakyTest.class } )
+public class FlakyTestSuite
+{
}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/a561181a/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java b/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
index b622aea..536da71 100644
--- a/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
+++ b/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
@@ -159,7 +159,7 @@ public class JUnit4Provider
}
}
- private void executeWithRerun( Class<?> clazz, RunNotifier listeners )
+ private void executeWithRerun( Class<?> clazz, RunNotifier listeners ) throws TestSetFailedException
{
JUnitTestFailureListener failureListener = new JUnitTestFailureListener();
listeners.addListener( failureListener );
@@ -275,6 +275,7 @@ public class JUnit4Provider
}
private void executeFailedMethod( RunNotifier notifier, Set<ClassMethod> failedMethods )
+ throws TestSetFailedException
{
for ( ClassMethod failedMethod : failedMethods )
{
@@ -286,7 +287,7 @@ public class JUnit4Provider
}
catch ( ClassNotFoundException e )
{
- throw new RuntimeException( "Unable to create test class '" + failedMethod.getClazz() + "'", e );
+ throw new TestSetFailedException( "Unable to create test class '" + failedMethod.getClazz() + "'", e );
}
}
}
[03/10] maven-surefire git commit: Check that flaky tests are counted
as such
Posted by ti...@apache.org.
Check that flaky tests are counted as such
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/62aa7983
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/62aa7983
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/62aa7983
Branch: refs/heads/master
Commit: 62aa79835aaf2552035ee7de91c5e1dfc2e1db68
Parents: a561181
Author: Sean Flanigan <sf...@redhat.com>
Authored: Thu Apr 16 16:55:44 2015 +1000
Committer: Sean Flanigan <sf...@redhat.com>
Committed: Thu Apr 16 16:55:44 2015 +1000
----------------------------------------------------------------------
.../surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/62aa7983/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
index 7385b22..c17c661 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
@@ -36,7 +36,7 @@ public class Surefire1152RerunFailingTestsInSuiteIT
public void rerunsFailingTestInSuite()
{
OutputValidator outputValidator = unpack( "surefire-1152-rerunFailingTestsCount-suite" ).executeVerify();
- outputValidator.assertTestSuiteResults( 1, 0, 0, 0 );
+ outputValidator.assertTestSuiteResults( 3, 0, 0, 0, 3 );
outputValidator.assertIntegrationTestSuiteResults( 1, 0, 0, 0 );
}
}
[10/10] maven-surefire git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/maven-surefire into SUREFIRE-1152
Posted by ti...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/maven-surefire into SUREFIRE-1152
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/5c3a3138
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/5c3a3138
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/5c3a3138
Branch: refs/heads/master
Commit: 5c3a3138e3587c9d0f3be49bdafc61f929309e99
Parents: 9c480ec 710a3d5
Author: Tibor17 <ti...@lycos.com>
Authored: Sat May 2 11:55:55 2015 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sat May 2 11:55:55 2015 +0200
----------------------------------------------------------------------
.../maven/plugin/failsafe/VerifyMojo.java | 37 ++++++---
.../Surefire1024VerifyFailsafeIfTestedIT.java | 48 ++++++++++++
.../test/resources/runorder-parallel/pom.xml | 54 ++++++-------
.../src/test/java/runorder/parallel/Test1.java | 12 ++-
.../src/test/java/runorder/parallel/Test2.java | 36 +++++----
.../src/test/java/runorder/parallel/Test3.java | 58 ++++++++------
.../jiras-surefire-1024-it/pom.xml | 79 ++++++++++++++++++++
.../jiras-surefire-1024-testjar/pom.xml | 54 +++++++++++++
.../src/main/java/jiras/surefire1024/A1IT.java | 12 +++
.../src/test/resources/surefire-1024/pom.xml | 51 +++++++++++++
10 files changed, 358 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
[09/10] maven-surefire git commit: Merge branch 'SUREFIRE-1152' of
https://github.com/seanf/maven-surefire into SUREFIRE-1152
Posted by ti...@apache.org.
Merge branch 'SUREFIRE-1152' of https://github.com/seanf/maven-surefire into SUREFIRE-1152
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/9c480ec3
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/9c480ec3
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/9c480ec3
Branch: refs/heads/master
Commit: 9c480ec34065b47f2daaa175dbc52f463ccc7daf
Parents: d068351 78fb9b0
Author: Tibor17 <ti...@lycos.com>
Authored: Sat May 2 11:51:21 2015 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Sat May 2 11:51:21 2015 +0200
----------------------------------------------------------------------
.../surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java | 2 +-
.../apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java | 2 +-
.../org/apache/maven/surefire/junitcore/JUnitCoreProvider.java | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
[04/10] maven-surefire git commit: Check that inherited tests in
suites are rerun correctly
Posted by ti...@apache.org.
Check that inherited tests in suites are rerun correctly
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/fc9c08ae
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/fc9c08ae
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/fc9c08ae
Branch: refs/heads/master
Commit: fc9c08aed638d3ecacbe7f149da085a9fd63ccda
Parents: 62aa798
Author: Sean Flanigan <sf...@redhat.com>
Authored: Thu Apr 16 16:57:06 2015 +1000
Committer: Sean Flanigan <sf...@redhat.com>
Committed: Thu Apr 16 16:57:06 2015 +1000
----------------------------------------------------------------------
.../java/jiras/surefire1152/FlakyParent.java | 45 ++++++++++++++++++++
.../test/java/jiras/surefire1152/FlakyTest.java | 2 +-
.../java/jiras/surefire1152/FlakyTestSuite.java | 2 +-
3 files changed, 47 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fc9c08ae/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyParent.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyParent.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyParent.java
new file mode 100644
index 0000000..77dc1be
--- /dev/null
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyParent.java
@@ -0,0 +1,45 @@
+package jiras.surefire1152;
+
+/*
+ * 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.junit.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.junit.Assert.fail;
+
+public abstract class FlakyParent
+{
+ // set of test classes which have previously invoked testFlakyParent
+ private static final Set<Class<?>> previouslyRun = new HashSet<Class<?>>();
+
+ @Test
+ public void testFlakyParent()
+ {
+ Class<?> clazz = getClass();
+ if ( !previouslyRun.contains( clazz ) )
+ {
+ previouslyRun.add( clazz );
+ fail( "deliberately flaky test (should pass the next time)" );
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fc9c08ae/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
index cab834c..ee20f9e 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTest.java
@@ -23,7 +23,7 @@ import org.junit.Test;
import static org.junit.Assert.fail;
-public class FlakyTest
+public class FlakyTest extends FlakyParent
{
private static int n;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fc9c08ae/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
index 85ec1b3..f4a7d67 100644
--- a/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
+++ b/surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyTestSuite.java
@@ -23,7 +23,7 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith( Suite.class )
-@Suite.SuiteClasses( { FlakyTest.class } )
+@Suite.SuiteClasses( { FlakyTest.class, FlakyParent.class } )
public class FlakyTestSuite
{
}
[07/10] maven-surefire git commit: Merge remote-tracking branch
'origin/SUREFIRE-1152' into SUREFIRE-1152
Posted by ti...@apache.org.
Merge remote-tracking branch 'origin/SUREFIRE-1152' into SUREFIRE-1152
Conflicts:
surefire-integration-tests/src/test/resources/surefire-1152-rerunFailingTestsCount-suite/src/test/java/jiras/surefire1152/FlakyParent.java
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/d0683512
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/d0683512
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/d0683512
Branch: refs/heads/master
Commit: d0683512365fb5d6da7381b33a0c21f74c6749b4
Parents: fc9c08a 7552ea9
Author: Tibor17 <ti...@lycos.com>
Authored: Tue Apr 28 22:19:54 2015 +0200
Committer: Tibor17 <ti...@lycos.com>
Committed: Tue Apr 28 22:19:54 2015 +0200
----------------------------------------------------------------------
.../Surefire1152RerunFailingTestsInSuiteIT.java | 27 ++++++++-
.../pom.xml | 61 ++++++++++++++++++++
.../java/jiras/surefire1152/FlakyParent.java | 2 +-
.../common/junit4/JUnit4ProviderUtil.java | 44 ++++++--------
.../common/junit4/JUnit4ProviderUtilTest.java | 8 +--
.../surefire/junitcore/JUnitCoreProvider.java | 2 +-
6 files changed, 109 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
[08/10] maven-surefire git commit: Add review changes requested by
Tibor Digana
Posted by ti...@apache.org.
Add review changes requested by Tibor Digana
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/78fb9b05
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/78fb9b05
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/78fb9b05
Branch: refs/heads/master
Commit: 78fb9b054a12cfeb5a4e4306e12fe894e50a5dff
Parents: 7552ea9
Author: Sean Flanigan <sf...@redhat.com>
Authored: Thu Apr 30 17:51:36 2015 +1000
Committer: Sean Flanigan <sf...@redhat.com>
Committed: Thu Apr 30 17:51:36 2015 +1000
----------------------------------------------------------------------
.../surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java | 2 +-
.../apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java | 2 +-
.../org/apache/maven/surefire/junitcore/JUnitCoreProvider.java | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/78fb9b05/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
index e0bc7de..fbf87d5 100644
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1152RerunFailingTestsInSuiteIT.java
@@ -42,7 +42,7 @@ public class Surefire1152RerunFailingTestsInSuiteIT
{
launcher.addGoal( goal );
}
- OutputValidator outputValidator = launcher.executeTest();
+ OutputValidator outputValidator = launcher.executeVerify();
outputValidator.assertTestSuiteResults( 3, 0, 0, 0, 3 );
outputValidator.assertIntegrationTestSuiteResults( 1, 0, 0, 0 );
return outputValidator;
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/78fb9b05/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
----------------------------------------------------------------------
diff --git a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
index 6861a21..05988b7 100644
--- a/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
+++ b/surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4ProviderUtil.java
@@ -64,7 +64,7 @@ public final class JUnit4ProviderUtil
{
try
{
- Class testClassObj = Class.forName( classMethod.getClazz(), true, testClassLoader );
+ Class testClassObj = Class.forName( classMethod.getClazz(), false, testClassLoader );
Set<String> failingMethods = testClassMethods.get( testClassObj );
if ( failingMethods == null )
{
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/78fb9b05/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
index bc2dd3b..66147ad 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java
@@ -152,7 +152,7 @@ public class JUnitCoreProvider
final FilterFactory filterFactory = new FilterFactory( testClassLoader );
Filter failingMethodsFilter = filterFactory.createFailingMethodFilter( failingTests );
JUnitCoreWrapper.execute( consoleLogger, testsToRun, jUnitCoreParameters, customRunListeners,
- filterFactory.and( filter, failingMethodsFilter ) );
+ failingMethodsFilter );
}
}
return reporterFactory.close();