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 2018/02/18 00:47:31 UTC
[19/52] [abbrv] [partial] maven-surefire git commit: [SUREFIRE-1471]
Too long Windows path cause CI issues. Renamed surefire-intergation-tests to
surefire-its.
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4RerunFailingTestsIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4RerunFailingTestsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4RerunFailingTestsIT.java
new file mode 100644
index 0000000..7d6f560
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4RerunFailingTestsIT.java
@@ -0,0 +1,278 @@
+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 <a href="mailto:qingzhouluo@google.com">Qingzhou Luo</a>
+ */
+public class JUnit4RerunFailingTestsIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ private SurefireLauncher unpack()
+ {
+ return unpack( "/junit4-rerun-failing-tests" );
+ }
+
+ @Test
+ public void testRerunFailingErrorTestsWithOneRetry()
+ throws Exception
+ {
+ OutputValidator outputValidator =
+ unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0,
+ 0 );
+ verifyFailuresOneRetryAllClasses( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).addGoal(
+ "-DforkCount=2" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );
+ verifyFailuresOneRetryAllClasses( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=methods" ).addGoal(
+ "-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );
+ verifyFailuresOneRetryAllClasses( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=classes" ).addGoal(
+ "-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );
+ verifyFailuresOneRetryAllClasses( outputValidator );
+ }
+
+ @Test
+ public void testRerunFailingErrorTestsTwoRetry()
+ throws Exception
+ {
+ // Four flakes, both tests have been re-run twice
+ OutputValidator outputValidator =
+ unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=2" ).executeTest().assertTestSuiteResults( 5, 0, 0, 0, 4 );
+
+ verifyFailuresTwoRetryAllClasses( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=2" ).addGoal( "-DforkCount=3" ).executeTest()
+ .assertTestSuiteResults( 5, 0, 0, 0, 4 );
+
+ verifyFailuresTwoRetryAllClasses( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=2" ).addGoal( "-Dparallel=methods" ).addGoal(
+ "-DuseUnlimitedThreads=true" ).executeTest().assertTestSuiteResults( 5, 0, 0, 0, 4 );
+
+ verifyFailuresTwoRetryAllClasses( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=2" ).addGoal( "-Dparallel=classes" ).addGoal(
+ "-DuseUnlimitedThreads=true" ).executeTest().assertTestSuiteResults( 5, 0, 0, 0, 4 );
+
+ verifyFailuresTwoRetryAllClasses( outputValidator );
+ }
+
+ @Test
+ public void testRerunFailingErrorTestsFalse()
+ throws Exception
+ {
+ OutputValidator outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion(
+ "4.12" ).maven().withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );
+
+ verifyFailuresNoRetryAllClasses( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-DforkCount=3" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );
+
+ verifyFailuresNoRetryAllClasses( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dparallel=methods" ).addGoal(
+ "-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );
+
+ verifyFailuresNoRetryAllClasses( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dparallel=classes" ).addGoal(
+ "-DuseUnlimitedThreads=true" ).withFailure().executeTest().assertTestSuiteResults( 5, 1, 1, 0, 0 );
+
+ verifyFailuresNoRetryAllClasses( outputValidator );
+ }
+
+ @Test
+ public void testRerunOneTestClass()
+ throws Exception
+ {
+ OutputValidator outputValidator =
+ unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).addGoal(
+ "-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 );
+
+ verifyFailuresOneRetryOneClass( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-DforkCount=3" ).addGoal(
+ "-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 );
+
+ verifyFailuresOneRetryOneClass( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=methods" ).addGoal(
+ "-DuseUnlimitedThreads=true" ).addGoal(
+ "-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 );
+
+ verifyFailuresOneRetryOneClass( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=classes" ).addGoal(
+ "-DuseUnlimitedThreads=true" ).addGoal(
+ "-Dtest=FlakyFirstTimeTest" ).withFailure().executeTest().assertTestSuiteResults( 3, 1, 1, 0, 0 );
+
+ verifyFailuresOneRetryOneClass( outputValidator );
+ }
+
+ @Test
+ public void testRerunOneTestMethod()
+ throws Exception
+ {
+ OutputValidator outputValidator =
+ unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).addGoal(
+ "-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1,
+ 0, 0 );
+
+ verifyFailuresOneRetryOneMethod( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-DforkCount=3" ).addGoal(
+ "-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1, 0,
+ 0 );
+
+ verifyFailuresOneRetryOneMethod( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=methods" ).addGoal(
+ "-DuseUnlimitedThreads=true" ).addGoal(
+ "-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1, 0,
+ 0 );
+
+ verifyFailuresOneRetryOneMethod( outputValidator );
+
+ outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion( "4.12" ).maven().addGoal(
+ "-Dsurefire.rerunFailingTestsCount=1" ).addGoal( "-Dparallel=classes" ).addGoal(
+ "-DuseUnlimitedThreads=true" ).addGoal(
+ "-Dtest=FlakyFirstTimeTest#testFailing*" ).withFailure().executeTest().assertTestSuiteResults( 1, 0, 1, 0,
+ 0 );
+
+ verifyFailuresOneRetryOneMethod( outputValidator );
+ }
+
+ private void verifyFailuresOneRetryAllClasses( OutputValidator outputValidator )
+ {
+ verifyFailuresOneRetry( outputValidator, 5, 1, 1, 0 );
+ }
+
+ private void verifyFailuresTwoRetryAllClasses( OutputValidator outputValidator )
+ {
+ verifyFailuresTwoRetry( outputValidator, 5, 0, 0, 2 );
+ }
+
+ private void verifyFailuresNoRetryAllClasses( OutputValidator outputValidator )
+ {
+ verifyFailuresNoRetry( outputValidator, 5, 1, 1, 0 );
+ }
+
+ private void verifyFailuresOneRetryOneClass( OutputValidator outputValidator )
+ {
+ verifyFailuresOneRetry( outputValidator, 3, 1, 1, 0 );
+ }
+
+ private void verifyFailuresOneRetryOneMethod( OutputValidator outputValidator )
+ {
+ verifyOnlyFailuresOneRetry( outputValidator, 1, 1, 0, 0 );
+ }
+
+ private void verifyFailuresOneRetry( OutputValidator outputValidator, int run, int failures, int errors,
+ int flakes )
+ {
+ outputValidator.verifyTextInLog( "Failures:" );
+ outputValidator.verifyTextInLog( "Run 1: FlakyFirstTimeTest.testFailingTestOne" );
+ outputValidator.verifyTextInLog( "Run 2: FlakyFirstTimeTest.testFailingTestOne" );
+
+ outputValidator.verifyTextInLog( "Errors:" );
+ outputValidator.verifyTextInLog( "Run 1: FlakyFirstTimeTest.testErrorTestOne" );
+ outputValidator.verifyTextInLog( "Run 2: FlakyFirstTimeTest.testErrorTestOne" );
+
+ verifyStatistics( outputValidator, run, failures, errors, flakes );
+ }
+
+ private void verifyOnlyFailuresOneRetry( OutputValidator outputValidator, int run, int failures, int errors,
+ int flakes )
+ {
+ outputValidator.verifyTextInLog( "Failures:" );
+ outputValidator.verifyTextInLog( "Run 1: FlakyFirstTimeTest.testFailingTestOne" );
+ outputValidator.verifyTextInLog( "Run 2: FlakyFirstTimeTest.testFailingTestOne" );
+
+ verifyStatistics( outputValidator, run, failures, errors, flakes );
+ }
+
+ private void verifyFailuresTwoRetry( OutputValidator outputValidator, int run, int failures, int errors,
+ int flakes )
+ {
+ outputValidator.verifyTextInLog( "Flakes:" );
+ outputValidator.verifyTextInLog( "Run 1: FlakyFirstTimeTest.testFailingTestOne" );
+ outputValidator.verifyTextInLog( "Run 2: FlakyFirstTimeTest.testFailingTestOne" );
+ outputValidator.verifyTextInLog( "Run 3: PASS" );
+
+ outputValidator.verifyTextInLog( "Run 1: FlakyFirstTimeTest.testErrorTestOne" );
+ outputValidator.verifyTextInLog( "Run 2: FlakyFirstTimeTest.testErrorTestOne" );
+
+ verifyStatistics( outputValidator, run, failures, errors, flakes );
+ }
+
+ private void verifyFailuresNoRetry( OutputValidator outputValidator, int run, int failures, int errors, int flakes )
+ {
+ outputValidator.verifyTextInLog( "Failures:" );
+ outputValidator.verifyTextInLog( "testFailingTestOne(junit4.FlakyFirstTimeTest)" );
+ outputValidator.verifyTextInLog( "ERROR" );
+ outputValidator.verifyTextInLog( "testErrorTestOne(junit4.FlakyFirstTimeTest)" );
+
+ verifyStatistics( outputValidator, run, failures, errors, flakes );
+ }
+
+ private void verifyStatistics( OutputValidator outputValidator, int run, int failures, int errors, int flakes )
+ {
+ if ( flakes > 0 )
+ {
+ outputValidator.verifyTextInLog(
+ "Tests run: " + run + ", Failures: " + failures + ", Errors: " + errors + ", Skipped: 0, Flakes: "
+ + flakes );
+ }
+ else
+ {
+ outputValidator.verifyTextInLog(
+ "Tests run: " + run + ", Failures: " + failures + ", Errors: " + errors + ", Skipped: 0" );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java
new file mode 100644
index 0000000..433863e
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java
@@ -0,0 +1,73 @@
+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 <a href="mailto:matthew.gilliard@gmail.com">Matthew Gilliard</a>
+ */
+public class JUnit4RunListenerIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ private SurefireLauncher unpack()
+ {
+ return unpack( "/junit4-runlistener" );
+ }
+
+ @Test
+ public void testJUnit4RunListener()
+ throws Exception
+ {
+ final OutputValidator outputValidator = unpack().addGoal( "-Dprovider=surefire-junit4" ).setJUnitVersion(
+ "4.4" ).executeTest().verifyErrorFreeLog();
+ assertResults( outputValidator );
+ outputValidator.verifyTextInLog( "testRunStarted null" );
+ outputValidator.verifyTextInLog( "testFinished simpleTest" );
+ outputValidator.verifyTextInLog( "testRunFinished org.junit.runner.Result" );
+ }
+
+ @Test
+ public void testRunlistenerJunitCoreProvider()
+ throws Exception
+ {
+ final OutputValidator outputValidator =
+ unpack().addGoal( "-Dprovider=surefire-junit47" ).setJUnitVersion( "4.8.1" ).addGoal(
+ "-DjunitVersion=4.8.1" ).executeTest().verifyErrorFreeLog(); // Todo: Fix junitVesion
+ assertResults( outputValidator );
+ outputValidator.verifyTextInLog( "testRunStarted null" );
+ outputValidator.verifyTextInLog( "testFinished simpleTest" );
+ outputValidator.verifyTextInLog( "testRunFinished org.junit.runner.Result" );
+ }
+
+ private void assertResults( OutputValidator outputValidator )
+ {
+ outputValidator.assertTestSuiteResults( 1, 0, 0, 0 );
+ outputValidator.getTargetFile( "runlistener-output-1.txt" ).assertFileExists();
+ outputValidator.getTargetFile( "runlistener-output-2.txt" ).assertFileExists();
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java
new file mode 100644
index 0000000..8dd8f0c
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java
@@ -0,0 +1,87 @@
+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 java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+
+import static org.junit.runners.Parameterized.*;
+
+/**
+ * Basic suite test using all known versions of JUnit 4.x
+ *
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ */
+@RunWith( Parameterized.class )
+public class JUnit4VersionsIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+
+ @Parameters( name = "{index}: JUnit {0}" )
+ public static Collection<Object[]> junitVersions()
+ {
+ return Arrays.asList( new Object[][] {
+ { "4.0" },
+ { "4.1" },
+ { "4.2" },
+ { "4.3" },
+ { "4.3.1" },
+ { "4.4" },
+ { "4.5" },
+ { "4.6" },
+ { "4.7" },
+ { "4.8" },
+ { "4.8.1" },
+ { "4.8.2" },
+ { "4.9" },
+ { "4.10" },
+ { "4.11" },
+ { "4.12" }
+ } );
+ }
+
+ @Parameter
+ public String version;
+
+ private SurefireLauncher unpack()
+ {
+ return unpack( "/junit4", version );
+ }
+
+ @Test
+ public void testJunit()
+ throws Exception
+ {
+ runJUnitTest( version );
+ }
+
+ public void runJUnitTest( String version )
+ throws Exception
+ {
+ unpack().setJUnitVersion( version ).executeTest().verifyErrorFree( 1 );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java
new file mode 100644
index 0000000..0757a17
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitDepIT.java
@@ -0,0 +1,70 @@
+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.SurefireJUnit4IntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.Test;
+
+/**
+ * Test project using JUnit4.4 -dep. junit-dep includes only junit.* classes, and depends explicitly on hamcrest-core
+ *
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ */
+public class JUnitDepIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ public SurefireLauncher unpack()
+ {
+ return unpack( "/junit44-dep" );
+ }
+
+ @Test
+ public void testJUnit44Dep()
+ throws Exception
+ {
+ unpack().debugLogging().sysProp( "junit-dep.version", "4.4" ).executeTest().verifyErrorFree( 1 ).verifyTextInLog(
+ "surefire-junit4" ); // Ahem. Will match on the 4.7 provider too
+ }
+
+ @Test
+ public void testJUnit44DepWithSneaky381()
+ throws Exception
+ {
+ unpack().debugLogging().sysProp( "junit-dep.version", "4.4" ).activateProfile(
+ "provided381" ).executeTest().verifyErrorFree( 1 );
+ }
+
+ @Test
+ public void testJUnit47Dep()
+ throws Exception
+ {
+ unpack().debugLogging().sysProp( "junit-dep.version", "4.7" ).executeTest().verifyErrorFree( 1 ).verifyTextInLog(
+ "surefire-junit47" );
+ }
+
+ @Test
+ public void testJUnit48Dep()
+ throws Exception
+ {
+ unpack().debugLogging().sysProp( "junit-dep.version", "4.8" ).executeTest().verifyErrorFree( 1 ).verifyTextInLog(
+ "surefire-junit47" );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
new file mode 100644
index 0000000..165d745
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/Java9FullApiIT.java
@@ -0,0 +1,109 @@
+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.junit.Test;
+
+import java.io.File;
+
+import static org.apache.maven.surefire.its.fixture.SurefireLauncher.EXT_JDK_HOME;
+import static org.apache.maven.surefire.its.fixture.SurefireLauncher.EXT_JDK_HOME_KEY;
+import static org.hamcrest.Matchers.anyOf;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
+import static org.hamcrest.Matchers.is;
+
+/**
+ * Running Surefire on the top of JDK 9 and should be able to load
+ * classes of multiple different Jigsaw modules without error.
+ *
+ * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
+ * @since 2.20.1
+ */
+public class Java9FullApiIT
+ extends AbstractJigsawIT
+{
+
+ @Test
+ public void shouldLoadMultipleJavaModules_JavaHome() throws Exception
+ {
+ OutputValidator validator = assumeJigsaw()
+ .setForkJvm()
+ .debugLogging()
+ .execute( "verify" )
+ .verifyErrorFree( 1 );
+
+ validator.verifyTextInLog( "loaded class java.sql.SQLException" )
+ .verifyTextInLog( "loaded class javax.xml.ws.Holder" )
+ .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" )
+ .verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
+ .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
+ .assertThatLogLine( anyOf( is( "java.specification.version=9" ),
+ is( "java.specification.version=10" ) ),
+ greaterThanOrEqualTo( 1 ) );
+ }
+
+ @Test
+ public void shouldLoadMultipleJavaModules_JvmParameter() throws Exception
+ {
+ OutputValidator validator = assumeJava9Property()
+ .setForkJvm()
+ .debugLogging()
+ .sysProp( EXT_JDK_HOME_KEY, new File( EXT_JDK_HOME ).getCanonicalPath() )
+ .execute( "verify" )
+ .verifyErrorFree( 1 );
+
+ validator.verifyTextInLog( "loaded class java.sql.SQLException" )
+ .verifyTextInLog( "loaded class javax.xml.ws.Holder" )
+ .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" )
+ .verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
+ .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
+ .assertThatLogLine( anyOf( is( "java.specification.version=9" ),
+ is( "java.specification.version=10" ) ),
+ greaterThanOrEqualTo( 1 ) );
+ }
+
+ @Test
+ public void shouldLoadMultipleJavaModules_ToolchainsXML() throws Exception
+ {
+ OutputValidator validator = assumeJava9Property()
+ .setForkJvm()
+ .activateProfile( "use-toolchains" )
+ .addGoal( "--toolchains" )
+ .addGoal( System.getProperty( "maven.toolchains.file" ) )
+ .execute( "verify" )
+ .verifyErrorFree( 1 );
+
+ validator.verifyTextInLog( "loaded class java.sql.SQLException" )
+ .verifyTextInLog( "loaded class javax.xml.ws.Holder" )
+ .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" )
+ .verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
+ .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
+ .assertThatLogLine( anyOf( is( "java.specification.version=9" ),
+ is( "java.specification.version=10" ) ),
+ greaterThanOrEqualTo( 1 ) );
+ }
+
+ @Override
+ protected String getProjectDirectoryName()
+ {
+ return "java9-full-api";
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java
new file mode 100644
index 0000000..6280835
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/LongWindowsPathIT.java
@@ -0,0 +1,88 @@
+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;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.apache.commons.lang3.SystemUtils.IS_OS_WINDOWS;
+import static org.fest.assertions.Assertions.assertThat;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assume.assumeTrue;
+
+/**
+ * Testing long path of base.dir where Windows CLI crashes.
+ * <br>
+ * Integration test for <a href="https://issues.apache.org/jira/browse/SUREFIRE-1400">SUREFIRE-1400</a>.
+ *
+ * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
+ * @since 2.20.1
+ */
+public class LongWindowsPathIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ private static final String PROJECT_DIR = "long-windows-path";
+ private static final String LONG_PATH = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+
+ // the IT engine crashes using long path
+ private static final String LONG_DIR = LONG_PATH + LONG_PATH + LONG_PATH;
+
+ @Test
+ public void shouldRunInSystemTmp() throws Exception
+ {
+ assumeTrue( IS_OS_WINDOWS );
+
+ OutputValidator validator = unpack().setForkJvm()
+ .showErrorStackTraces()
+ .executeTest()
+ .verifyErrorFreeLog();
+
+ validator.assertThatLogLine( containsString( "SUREFIRE-1400 user.dir=" ), is( 1 ) )
+ .assertThatLogLine( containsString( "SUREFIRE-1400 surefire.real.class.path=" ), is( 1 ) );
+
+ for ( String line : validator.loadLogLines() )
+ {
+ if ( line.contains( "SUREFIRE-1400 user.dir=" ) )
+ {
+ File buildDir = new File( System.getProperty( "user.dir" ), "target" );
+ File itBaseDir = new File( buildDir, "LongWindowsPathIT_shouldRunInSystemTmp" );
+
+ assertThat( line )
+ .contains( itBaseDir.getAbsolutePath() );
+ }
+ else if ( line.contains( "SUREFIRE-1400 surefire.real.class.path=" ) )
+ {
+ assertThat( line )
+ .contains( System.getProperty( "java.io.tmpdir" ) );
+ }
+ }
+ }
+
+ private SurefireLauncher unpack() throws IOException
+ {
+ return unpack( PROJECT_DIR/*, "_" + LONG_DIR*/ );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/ModulePathIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/ModulePathIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/ModulePathIT.java
new file mode 100644
index 0000000..3c3d2c6
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/ModulePathIT.java
@@ -0,0 +1,45 @@
+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.junit.Test;
+
+import java.io.IOException;
+
+public class ModulePathIT
+ extends AbstractJigsawIT
+{
+ @Test
+ public void testModulePath()
+ throws IOException
+ {
+ assumeJigsaw()
+ .debugLogging()
+ .executeTest()
+ .verifyErrorFreeLog()
+ .assertTestSuiteResults( 2 );
+ }
+
+ @Override
+ protected String getProjectDirectoryName()
+ {
+ return "modulepath";
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/NoRunnableTestsInClassIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/NoRunnableTestsInClassIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/NoRunnableTestsInClassIT.java
new file mode 100644
index 0000000..1be88b7
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/NoRunnableTestsInClassIT.java
@@ -0,0 +1,39 @@
+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.SurefireJUnit4IntegrationTestCase;
+import org.junit.Test;
+
+/**
+ * SUREFIRE-621 Asserts proper test counts when running junit 3 tests in parallel
+ *
+ * @author Kristian Rosenvold
+ */
+public class NoRunnableTestsInClassIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ @Test
+ public void testJunit3ParallelBuildResultCount()
+ {
+ unpack( "norunnableTests" ).failNever().executeTest().verifyTextInLog(
+ "No tests found in junit.norunnabletests.BasicTest" );
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/PlainOldJavaClasspathIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/PlainOldJavaClasspathIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/PlainOldJavaClasspathIT.java
new file mode 100644
index 0000000..71bccd6
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/PlainOldJavaClasspathIT.java
@@ -0,0 +1,38 @@
+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.SurefireJUnit4IntegrationTestCase;
+import org.junit.Test;
+
+/**
+ * Test useManifestOnlyJar option
+ *
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ */
+public class PlainOldJavaClasspathIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ @Test
+ public void testPlainOldJavaClasspath()
+ {
+ executeErrorFreeTest( "plain-old-java-classpath", 1 );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/PlexusConflictIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/PlexusConflictIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/PlexusConflictIT.java
new file mode 100644
index 0000000..bec3e99
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/PlexusConflictIT.java
@@ -0,0 +1,50 @@
+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.SurefireJUnit4IntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.Test;
+
+/**
+ * Test library using a conflicting version of plexus-utils
+ *
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ */
+public class PlexusConflictIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ @Test
+ public void testPlexusConflict()
+ {
+ unpack().executeTest().verifyErrorFree( 1 );
+ }
+
+ @Test
+ public void testPlexusConflictIsolatedClassLoader()
+ {
+ unpack().useSystemClassLoader(false).executeTest().verifyErrorFree( 1 );
+ }
+
+ private SurefireLauncher unpack()
+ {
+ return unpack( "/plexus-conflict" );
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/PojoSimpleIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/PojoSimpleIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/PojoSimpleIT.java
new file mode 100644
index 0000000..03902ef
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/PojoSimpleIT.java
@@ -0,0 +1,38 @@
+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.SurefireJUnit4IntegrationTestCase;
+import org.junit.Test;
+
+/**
+ * Test support for POJO tests.
+ *
+ * @author Benjamin Bentmann
+ */
+public class PojoSimpleIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ @Test
+ public void testit()
+ {
+ unpack( "pojo-simple" ).executeTest().assertTestSuiteResults( 2, 0, 1, 0 );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/ReporterTime.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/ReporterTime.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/ReporterTime.java
new file mode 100644
index 0000000..154fb73
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/ReporterTime.java
@@ -0,0 +1,26 @@
+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.
+ */
+
+/**
+ * @author Kristian Rosenvold
+ */
+public class ReporterTime
+{
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/ReportersIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/ReportersIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/ReportersIT.java
new file mode 100644
index 0000000..b1c68f0
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/ReportersIT.java
@@ -0,0 +1,45 @@
+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.junit.Test;
+
+/**
+ * Asserts proper behaviour of console output when forking
+ * SUREFIRE-679
+ *
+ * @author Kristian Rosenvold
+ */
+public class ReportersIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ @Test
+ public void testRedirectOutputTestNg()
+ {
+ OutputValidator reporters = unpack( "reporters" ).redirectToFile( true ).printSummary( true ).executeTest();
+
+ reporters.getSurefireReportsFile( "TestSuite-output.txt" ).assertFileExists();
+ reporters.getSurefireReportsXmlFile( "TEST-TestSuite.xml" ).assertFileExists();
+ reporters.getSurefireReportsFile( "TestSuite.txt" ).assertFileExists();
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/ResultCountingIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/ResultCountingIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/ResultCountingIT.java
new file mode 100644
index 0000000..714d0c4
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/ResultCountingIT.java
@@ -0,0 +1,66 @@
+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.it.VerificationException;
+import org.apache.maven.surefire.its.fixture.OutputValidator;
+import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
+import org.junit.Test;
+
+import java.io.IOException;
+
+/**
+ * Verifies that the providers get the result summary at the bottom of the run correctly, in different forkmodes
+ * SUREFIRE-613 Asserts proper test counts when running in parallel
+ *
+ * @author Kristian Rosenvold
+ */
+public class ResultCountingIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ @Test
+ public void testCountingWithJunit481ForkNever()
+ throws Exception
+ {
+ assertForkMode( "never" );
+ }
+
+ @Test
+ public void testCountingWithJunit481ForkOnce()
+ throws Exception
+ {
+ assertForkMode( "once" );
+ }
+
+ @Test
+ public void testCountingWithJunit481ForkAlways()
+ throws Exception
+ {
+ assertForkMode( "always" );
+ }
+
+ private void assertForkMode( String forkMode )
+ throws IOException, VerificationException
+ {
+ OutputValidator outputValidator = unpack( "result-counting" ).failNever().forkMode( forkMode ).executeTest();
+ outputValidator.assertTestSuiteResults( 36, 23, 4, 2 );
+ outputValidator.verifyTextInLog( "Tests run: 36, Failures: 4, Errors: 23, Skipped: 2" );
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java
new file mode 100644
index 0000000..099aa07
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java
@@ -0,0 +1,108 @@
+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 java.io.IOException;
+import java.util.Calendar;
+import org.apache.maven.it.VerificationException;
+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;
+
+/**
+ * Verifies the runOrder setting and its effect
+ *
+ * @author Kristian Rosenvold
+ */
+public class RunOrderIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ private static final String[] TESTS_IN_ALPHABETICAL_ORDER = { "TA", "TB", "TC" };
+
+ private static final String[] TESTS_IN_REVERSE_ALPHABETICAL_ORDER = { "TC", "TB", "TA" };
+
+ // testing random is left as an exercise to the reader. Patches welcome
+
+ @Test
+ public void testAlphabetical()
+ throws Exception
+ {
+ OutputValidator validator = executeWithRunOrder( "alphabetical" );
+ assertTestnamesAppearInSpecificOrder( validator, TESTS_IN_ALPHABETICAL_ORDER );
+ }
+
+ @Test
+ public void testReverseAlphabetical()
+ throws Exception
+ {
+ OutputValidator validator = executeWithRunOrder( "reversealphabetical" );
+ assertTestnamesAppearInSpecificOrder( validator, TESTS_IN_REVERSE_ALPHABETICAL_ORDER );
+ }
+
+ @Test
+ public void testHourly()
+ throws Exception
+ {
+ int startHour = Calendar.getInstance().get( Calendar.HOUR_OF_DAY );
+ OutputValidator validator = executeWithRunOrder( "hourly" );
+ int endHour = Calendar.getInstance().get( Calendar.HOUR_OF_DAY );
+ if ( startHour != endHour )
+ {
+ return; // Race condition, cannot test when hour changed mid-run
+ }
+
+ String[] testnames =
+ ( ( startHour % 2 ) == 0 ) ? TESTS_IN_ALPHABETICAL_ORDER : TESTS_IN_REVERSE_ALPHABETICAL_ORDER;
+ assertTestnamesAppearInSpecificOrder( validator, testnames );
+ }
+
+ @Test
+ public void testNonExistingRunOrder()
+ throws Exception
+ {
+ unpack().forkMode( getForkMode() ).runOrder( "nonExistingRunOrder" ).maven().withFailure().executeTest().verifyTextInLog(
+ "There's no RunOrder with the name nonExistingRunOrder." );
+ }
+
+ private OutputValidator executeWithRunOrder( String runOrder )
+ {
+ return unpack().forkMode( getForkMode() ).runOrder( runOrder ).executeTest().verifyErrorFree( 3 );
+ }
+
+ protected String getForkMode()
+ {
+ return "once";
+ }
+
+ private SurefireLauncher unpack()
+ {
+ return unpack( "runOrder" );
+ }
+
+ private void assertTestnamesAppearInSpecificOrder( OutputValidator validator, String[] testnames )
+ throws VerificationException
+ {
+ if ( !validator.stringsAppearInSpecificOrderInLog( testnames ) )
+ {
+ throw new VerificationException( "Response does not contain expected item" );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderParallelForksIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderParallelForksIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderParallelForksIT.java
new file mode 100644
index 0000000..72fc428
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderParallelForksIT.java
@@ -0,0 +1,31 @@
+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.
+ */
+
+public class RunOrderParallelForksIT
+ extends RunOrderIT
+{
+
+ @Override
+ protected String getForkMode()
+ {
+ return "perthread";
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/SiblingAggregatorIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/SiblingAggregatorIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/SiblingAggregatorIT.java
new file mode 100644
index 0000000..69c9e4c
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/SiblingAggregatorIT.java
@@ -0,0 +1,47 @@
+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;
+
+/**
+ * Test aggregator as a sibling to child modules; invokes modules as "../child"
+ *
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ * @author <a href="mailto:krosenvold@apache.org">Kristian Rosenvold</a>
+ */
+public class SiblingAggregatorIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+
+ @Test
+ public void testSiblingAggregator()
+ throws Exception
+ {
+ final SurefireLauncher unpack = unpack( "sibling-aggregator" );
+ SurefireLauncher aggregator = unpack.getSubProjectLauncher( "aggregator" );
+ aggregator.executeTest().verifyErrorFreeLog();
+ OutputValidator child2 = unpack.getSubProjectValidator( "child2" );
+ child2.assertTestSuiteResults( 1, 0, 0, 0 );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/SmartStackTraceIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/SmartStackTraceIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/SmartStackTraceIT.java
new file mode 100644
index 0000000..b98155e
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/SmartStackTraceIT.java
@@ -0,0 +1,44 @@
+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.junit.Test;
+
+/**
+ * IT of smart stack trace parser
+ *
+ * @author Kristian Rosenvold
+ */
+public class SmartStackTraceIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+
+ @Test
+ public void misg()
+ throws Exception
+ {
+ OutputValidator outputValidator = unpack( "/junit48-smartStackTrace" ).maven().withFailure().executeTest();
+ outputValidator.verifyTextInLog( "SmartStackTraceTest.shouldFailInMethodButDoesnt Expected exception: java.lang.RuntimeException" );
+ outputValidator.verifyTextInLog( "SmartStackTraceTest.shortName Expected exception: java.io.IOException" );
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/SystemPropertiesTestIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/SystemPropertiesTestIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/SystemPropertiesTestIT.java
new file mode 100644
index 0000000..121b8fc
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/SystemPropertiesTestIT.java
@@ -0,0 +1,55 @@
+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.SurefireJUnit4IntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.Test;
+
+/**
+ * Test system properties
+ *
+ * @author <a href="mailto:dfabulich@apache.org">Dan Fabulich</a>
+ */
+public class SystemPropertiesTestIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+
+ @Test
+ public void testSystemProperties()
+ {
+ unpack().addGoal( "-DsetOnMavenCommandLine=baz" ).addGoal(
+ "-DsetOnArgLineWorkAround=baz" ).executeTest().verifyErrorFree( 8 );
+ }
+
+ @Test
+ public void testSystemPropertiesNoFork()
+ {
+
+ unpack().forkNever().addGoal( "-DsetOnMavenCommandLine=baz" ).addGoal( "-DsetOnArgLineWorkAround=baz" )
+ // DGF fake the argLine, since we're not forking
+ .addGoal( "-DsetOnArgLine=bar" ).executeTest().verifyErrorFree( 8 );
+ }
+
+ public SurefireLauncher unpack()
+ {
+ return unpack( "/system-properties" );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMethodPatternIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMethodPatternIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMethodPatternIT.java
new file mode 100644
index 0000000..447d8f1
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMethodPatternIT.java
@@ -0,0 +1,115 @@
+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;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * Test project using -Dtest=mtClass#myMethod
+ *
+ * @author Olivier Lamy
+ */
+public class TestMethodPatternIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ private static final String RUNNING_WITH_PROVIDER47 = "parallel='none', perCoreThreadCount=true, threadCount=0";
+
+ public OutputValidator runMethodPattern( String projectName, Map<String, String> props, String... goals )
+ {
+ SurefireLauncher launcher = unpack( projectName );
+ for ( Entry<String, String> entry : props.entrySet() )
+ {
+ launcher.sysProp( entry.getKey(), entry.getValue() );
+ }
+ for ( String goal : goals )
+ {
+ launcher.addGoal( goal );
+ }
+ return launcher.showErrorStackTraces().debugLogging()
+ .executeTest()
+ .assertTestSuiteResults( 2, 0, 0, 0 );
+ }
+
+ @Test
+ public void testJUnit44()
+ {
+ runMethodPattern( "junit44-method-pattern", Collections.<String, String>emptyMap() );
+ }
+
+ @Test
+ public void testJUnit48Provider4()
+ {
+ runMethodPattern( "junit48-method-pattern", Collections.<String, String>emptyMap(), "-P surefire-junit4" );
+ }
+
+ @Test
+ public void testJUnit48Provider47()
+ {
+ runMethodPattern( "junit48-method-pattern", Collections.<String, String>emptyMap(), "-P surefire-junit47" )
+ .verifyTextInLog( RUNNING_WITH_PROVIDER47 );
+ }
+
+ @Test
+ public void testJUnit48WithCategoryFilter()
+ {
+ unpack( "junit48-method-pattern" )
+ .addGoal( "-Dgroups=junit4.SampleCategory" )
+ .executeTest()
+ .assertTestSuiteResults( 1, 0, 0, 0 );
+ }
+
+ @Test
+ public void testTestNgMethodBefore()
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put( "testNgVersion", "5.7" );
+ props.put( "testNgClassifier", "jdk15" );
+ runMethodPattern( "testng-method-pattern-before", props );
+ }
+
+ @Test
+ public void testTestNGMethodPattern()
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put( "testNgVersion", "5.7" );
+ props.put( "testNgClassifier", "jdk15" );
+ runMethodPattern( "/testng-method-pattern", props );
+ }
+
+ @Test
+ public void testMethodPatternAfter()
+ {
+ unpack( "testng-method-pattern-after" )
+ .sysProp( "testNgVersion", "5.7" )
+ .sysProp( "testNgClassifier", "jdk15" )
+ .executeTest()
+ .verifyErrorFree( 2 )
+ .verifyTextInLog( "Called tearDown" );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsIT.java
new file mode 100644
index 0000000..d490ce5
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsIT.java
@@ -0,0 +1,67 @@
+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.Settings;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+
+/**
+ * JUnit test project using multiple method patterns, including wildcards in class and method names.
+ */
+@RunWith( Parameterized.class )
+public class TestMultipleMethodPatternsIT
+ extends AbstractTestMultipleMethodPatterns
+{
+ private final Settings settings;
+
+ public TestMultipleMethodPatternsIT( Settings settings )
+ {
+ this.settings = settings;
+ }
+
+ @Parameterized.Parameters
+ public static Iterable<Object[]> data()
+ {
+ return Arrays.asList( new Object[][]{
+ { Settings.JUNIT4_TEST },
+ { Settings.JUNIT47_TEST },
+ { Settings.JUNIT4_INCLUDES },
+ { Settings.JUNIT47_INCLUDES },
+ { Settings.JUNIT4_INCLUDES_EXCLUDES },
+ { Settings.JUNIT47_INCLUDES_EXCLUDES }
+ } );
+ }
+
+ @Override
+ protected Settings getSettings()
+ {
+ return settings;
+ }
+
+ @Override
+ protected SurefireLauncher unpack()
+ {
+ return unpack( "junit48-multiple-method-patterns", "_" + settings.path() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsTestNGIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsTestNGIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsTestNGIT.java
new file mode 100644
index 0000000..2de3670
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodPatternsTestNGIT.java
@@ -0,0 +1,64 @@
+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.Settings;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+
+/**
+ * TestNG test project using multiple method patterns, including wildcards in class and method names.
+ */
+@RunWith( Parameterized.class )
+public class TestMultipleMethodPatternsTestNGIT
+ extends AbstractTestMultipleMethodPatterns
+{
+ private final Settings settings;
+
+ public TestMultipleMethodPatternsTestNGIT( Settings settings )
+ {
+ this.settings = settings;
+ }
+
+ @Parameterized.Parameters
+ public static Iterable<Object[]> data()
+ {
+ return Arrays.asList( new Object[][]{
+ { Settings.TestNG_TEST },
+ { Settings.TestNG_INCLUDES },
+ { Settings.TestNG_INCLUDES_EXCLUDES }
+ } );
+ }
+
+ @Override
+ protected Settings getSettings()
+ {
+ return settings;
+ }
+
+ @Override
+ protected SurefireLauncher unpack()
+ {
+ return unpack( "testng-multiple-method-patterns", "_" + settings.path() );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodsIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodsIT.java
new file mode 100644
index 0000000..cb773cd
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestMultipleMethodsIT.java
@@ -0,0 +1,74 @@
+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;
+
+
+/**
+ * Test project using -Dtest=mtClass#myMethod+myMethod2,secondClass#testMethod
+ *
+ * @author <a href="mailto:ytsolar@gmail.com">rainLee</a>
+ */
+public class TestMultipleMethodsIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+
+ private static final String RUNNING_WITH_PROVIDER47 = "parallel='none', perCoreThreadCount=true, threadCount=0";
+
+ public OutputValidator multipleMethod( String projectName, String... goals )
+ throws Exception
+ {
+ SurefireLauncher launcher = unpack( projectName );
+ for ( String goal : goals )
+ {
+ launcher.addGoal( goal );
+ }
+ return launcher.showErrorStackTraces().debugLogging()
+ .executeTest()
+ .verifyErrorFreeLog().assertTestSuiteResults( 3, 0, 0, 0 );
+ }
+
+ @Test
+ public void testJunit44()
+ throws Exception
+ {
+ multipleMethod( "junit44-multiple-methods" );
+ }
+
+ @Test
+ public void testJunit48Provider4()
+ throws Exception
+ {
+ multipleMethod( "junit48-multiple-methods", "-P surefire-junit4" );
+ }
+
+ @Test
+ public void testJunit48Provider47()
+ throws Exception
+ {
+ multipleMethod( "junit48-multiple-methods", "-P surefire-junit47" )
+ .verifyTextInLog( RUNNING_WITH_PROVIDER47 );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgGroupsIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgGroupsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgGroupsIT.java
new file mode 100644
index 0000000..74771c8
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgGroupsIT.java
@@ -0,0 +1,69 @@
+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.SurefireJUnit4IntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+
+import org.junit.Test;
+
+/**
+ * Test the group filter for TestNG
+ *
+ */
+public class TestNgGroupsIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ @Test
+ public void testExclusion()
+ {
+ unpack().setExcludedGroups( "notincluded" ).executeTest().verifyErrorFree( 5 );
+ }
+
+ @Test
+ public void testOnlyGroups()
+ {
+ unpack().setGroups( "functional" ).executeTest().verifyErrorFree( 2 );
+ }
+
+ @Test
+ public void testGroupsAndExclusion()
+ {
+ unpack().setGroups( "functional" ).setExcludedGroups( "notincluded" ).executeTest().verifyErrorFree( 1 );
+ }
+
+ @Test
+ public void groupsWithDash()
+ {
+ unpack().setGroups( "abc-def" ).executeTest().verifyErrorFree( 1 );
+ }
+
+ @Test
+ public void groupsBySimpleRegex()
+ {
+ unpack().setGroups( "foo\\..*" ).executeTest().verifyErrorFree( 2 );
+ }
+
+ public SurefireLauncher unpack()
+ {
+ return unpack( "/testng-groups" );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgParallelWithAnnotationsIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgParallelWithAnnotationsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgParallelWithAnnotationsIT.java
new file mode 100644
index 0000000..1e6044e
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgParallelWithAnnotationsIT.java
@@ -0,0 +1,38 @@
+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.SurefireJUnit4IntegrationTestCase;
+import org.junit.Test;
+
+/**
+ * Test that TestNG's @Test(threadPoolSize = n, invocationCount=n) causes tests to be run in parallel.
+ *
+ * @author <a href="mailto:spam.haikal@gmail.com">Haikal Saadh</a>
+ */
+public class TestNgParallelWithAnnotationsIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ @Test
+ public void testTestNgGroupThreadParallel()
+ {
+ executeErrorFreeTest( "/testng-parallel-with-annotations", 3 );
+ }
+}
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgSuccessPercentageIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgSuccessPercentageIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgSuccessPercentageIT.java
new file mode 100644
index 0000000..3b12e03
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestNgSuccessPercentageIT.java
@@ -0,0 +1,45 @@
+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.junit.Test;
+
+/**
+ * Test that TestNG's @Test(successPercentage = n, invocationCount=n) passes so long as successPercentage tests
+ * have passed.
+ *
+ * @author Jon Todd
+ * @author Andreas Gudian
+ */
+public class TestNgSuccessPercentageIT extends SurefireJUnit4IntegrationTestCase {
+ @Test
+ public void testPassesWhenFailuresLessThanSuccessPercentage()
+ {
+ OutputValidator validator = unpack("/testng-succes-percentage")
+ .sysProp( "testNgVersion", "5.7" )
+ .sysProp( "testNgClassifier", "jdk15" )
+ .mavenTestFailureIgnore( true )
+ .executeTest();
+ validator.assertTestSuiteResults(8, 0, 1, 0);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4d00932a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestSingleMethodIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/TestSingleMethodIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestSingleMethodIT.java
new file mode 100644
index 0000000..53eddce
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/TestSingleMethodIT.java
@@ -0,0 +1,141 @@
+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;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Test project using -Dtest=mtClass#myMethod
+ *
+ * @author Olivier Lamy
+ */
+public class TestSingleMethodIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ private static final String RUNNING_WITH_PROVIDER47 = "parallel='none', perCoreThreadCount=true, threadCount=0";
+
+ public OutputValidator singleMethod( String projectName, Map<String, String> props, String testToRun,
+ String... goals )
+ throws Exception
+ {
+ SurefireLauncher launcher = unpack( projectName );
+ for ( Map.Entry<String, String> entry : props.entrySet() )
+ {
+ launcher.sysProp( entry.getKey(), entry.getValue() );
+ }
+ for ( String goal : goals )
+ {
+ launcher.addGoal( goal );
+ }
+ launcher.showErrorStackTraces().debugLogging();
+ if ( testToRun != null )
+ {
+ launcher.setTestToRun( testToRun );
+ }
+ return launcher.executeTest()
+ .verifyErrorFreeLog()
+ .assertTestSuiteResults( 1, 0, 0, 0 );
+ }
+
+ @Test
+ public void testJunit44()
+ throws Exception
+ {
+ singleMethod( "junit44-single-method", Collections.<String, String>emptyMap(), null );
+ }
+
+ @Test
+ public void testJunit48Provider4()
+ throws Exception
+ {
+ singleMethod( "junit48-single-method", Collections.<String, String>emptyMap(), null, "-P surefire-junit4" );
+ }
+
+ @Test
+ public void testJunit48Provider47()
+ throws Exception
+ {
+ singleMethod( "junit48-single-method", Collections.<String, String>emptyMap(), null, "-P surefire-junit47" )
+ .verifyTextInLog( RUNNING_WITH_PROVIDER47 );
+ }
+
+ @Test
+ public void testJunit48parallel()
+ throws Exception
+ {
+ unpack( "junit48-single-method" )
+ .parallel( "all" )
+ .useUnlimitedThreads()
+ .executeTest()
+ .verifyErrorFreeLog()
+ .assertTestSuiteResults( 1, 0, 0, 0 );
+ }
+
+ @Test
+ public void testTestNg()
+ throws Exception
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put( "testNgVersion", "5.7" );
+ props.put( "testNgClassifier", "jdk15" );
+ singleMethod( "testng-single-method", props, null );
+ }
+
+ @Test
+ public void testTestNg5149()
+ throws Exception
+ {
+ singleMethod( "/testng-single-method-5-14-9", Collections.<String, String>emptyMap(), null );
+ }
+
+ @Test
+ public void fullyQualifiedJunit48Provider4()
+ throws Exception
+ {
+ singleMethod( "junit48-single-method", Collections.<String, String>emptyMap(),
+ "junit4.BasicTest#testSuccessOne", "-P surefire-junit4" );
+ }
+
+ @Test
+ public void fullyQualifiedJunit48Provider47()
+ throws Exception
+ {
+ singleMethod("junit48-single-method", Collections.<String, String>emptyMap(),
+ "junit4.BasicTest#testSuccessOne", "-P surefire-junit47");
+ }
+
+ @Test
+ public void fullyQualifiedTestNg()
+ throws Exception
+ {
+ Map<String, String> props = new HashMap<String, String>();
+ props.put( "testNgVersion", "5.7" );
+ props.put( "testNgClassifier", "jdk15" );
+ singleMethod( "testng-single-method", props, "testng.BasicTest#testSuccessOne" );
+ }
+
+}