http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire621TestCountingJunit3InParallelIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire621TestCountingJunit3InParallelIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire621TestCountingJunit3InParallelIT.java new file mode 100644 index 0000000..a47b9d8 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire621TestCountingJunit3InParallelIT.java @@ -0,0 +1,98 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * SUREFIRE-621 Asserts proper test counts when running junit 3 tests in parallel<br> + * SUREFIRE-1264 Some tests can be lost when running in parallel with parameterized tests<br> + * <br> + * Removed decision making with JUnit3 in {@code TestSet} class during Jira activity of <tt>SUREFIRE-1264</tt> + * which results in one hot spot where the test class is determined (see JUnitCoreRunListener#fillTestCountMap()). + * + * @author Kristian Rosenvold + * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> + */ +public class Surefire621TestCountingJunit3InParallelIT + extends SurefireJUnit4IntegrationTestCase +{ + /** + * SUREFIRE-1264 + */ + @Test + public void testJunit3AllParallelBuildResultCount() + { + unpack( "surefire-621-testCounting-junit3-in-parallel" ) + .activateProfile( "all-parallel-junit3-testcases" ) + .execute( "integration-test" ) + .assertTestSuiteResults( 6, 0, 0, 0 ); + } + + /** + * SUREFIRE-621 + */ + @Test + public void testJunit3ParallelBuildResultCount() + { + unpack( "surefire-621-testCounting-junit3-in-parallel" ) + .failNever() + .activateProfile( "parallel-junit3-testcases" ) + .execute( "install" ) + .assertTestSuiteResults( 6, 0, 0, 0 ); + } + + /** + * SUREFIRE-1264 + */ + @Test + public void testJunit3BuildResultCount() + { + unpack( "surefire-621-testCounting-junit3-in-parallel" ) + .activateProfile( "junit3-testcases" ) + .execute( "integration-test" ) + .assertTestSuiteResults( 6, 0, 0, 0 ); + } + + /** + * SUREFIRE-1264 + */ + @Test + public void testJunit3ParallelSuiteBuildResultCount() + { + unpack( "surefire-621-testCounting-junit3-in-parallel" ) + .activateProfile( "parallel-junit3-testsuite" ) + .execute( "integration-test" ) + .assertTestSuiteResults( 6, 0, 0, 0 ); + } + + /** + * SUREFIRE-1264 + */ + @Test + public void testJunit3SuiteBuildResultCount() + { + unpack( "surefire-621-testCounting-junit3-in-parallel" ) + .activateProfile( "junit3-testsuite" ) + .execute( "integration-test" ) + .assertTestSuiteResults( 6, 0, 0, 0 ); + } +} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire628ConsoleOutputBeforeAndAfterClassIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire628ConsoleOutputBeforeAndAfterClassIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire628ConsoleOutputBeforeAndAfterClassIT.java new file mode 100644 index 0000000..27f9572 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire628ConsoleOutputBeforeAndAfterClassIT.java @@ -0,0 +1,48 @@ +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; + +/** + * Asserts that console output always goes somewhere ;) + * + * @author Kristian Rosenvold assertContainsText + */ +public class Surefire628ConsoleOutputBeforeAndAfterClassIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void testJunit3ParallelBuildResultCount() + { + OutputValidator validator = + unpack( "surefire-628-consoleoutputbeforeandafterclass" ).failNever().parallelMethods().executeTest(); + + validator.verifyTextInLog( "628Test1" ); + validator.verifyTextInLog( "Before628Test1" ); + validator.verifyTextInLog( "After628Test1" ); + validator.verifyTextInLog( "628Test2" ); + validator.verifyTextInLog( "BeforeClass628Test2" ); + validator.verifyTextInLog( "AfterClass628Test2" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire634UnsettableSystemPropertiesWarningIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire634UnsettableSystemPropertiesWarningIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire634UnsettableSystemPropertiesWarningIT.java new file mode 100644 index 0000000..778e776 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire634UnsettableSystemPropertiesWarningIT.java @@ -0,0 +1,39 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * SUREFIRE-634 Verifies error message on unsettable system properties + * + * @author Kristian Rosenvold + */ +public class Surefire634UnsettableSystemPropertiesWarningIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testJunit3ParallelBuildResultCount() + { + unpack( "/surefire-634-systemPropertiesWarning" ).executeTest().verifyTextInLog( + "java.library.path cannot be set as system property" ); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire649EmptyStringSystemPropertiesIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire649EmptyStringSystemPropertiesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire649EmptyStringSystemPropertiesIT.java new file mode 100644 index 0000000..d6f0a0e --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire649EmptyStringSystemPropertiesIT.java @@ -0,0 +1,84 @@ +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.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; + +import static org.junit.Assert.fail; + +/** + * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> + * @see <a href="https://issues.apache.org/jira/browse/SUREFIRE-649">SUREFIRE-649</a> + * @since 2.18 + */ +public class Surefire649EmptyStringSystemPropertiesIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void systemProperties() + throws VerificationException + { + SurefireLauncher launcher = unpack1(); + + OutputValidator validator = launcher.executeTest().verifyErrorFree( 1 ); + + for ( String line : validator.loadLogLines() ) + { + if ( "emptyProperty=''".equals( line ) ) + { + return; + } + } + fail("Could not find text in log: emptyProperty=''"); + } + + @Test + public void systemPropertyVariables() + throws VerificationException + { + SurefireLauncher launcher = unpack2(); + + OutputValidator validator = launcher.executeTest().verifyErrorFree( 1 ); + + for ( String line : validator.loadLogLines() ) + { + if ( "emptyProperty=''".equals( line ) ) + { + return; + } + } + fail("Could not find text in log: emptyProperty=''"); + } + + private SurefireLauncher unpack1() + { + return unpack( "surefire-649-systemProperties" ); + } + + private SurefireLauncher unpack2() + { + return unpack( "surefire-649-systemPropertyVariables" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire673MockitoIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire673MockitoIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire673MockitoIT.java new file mode 100644 index 0000000..7f3e2ca --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire673MockitoIT.java @@ -0,0 +1,38 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * SUREFIRE-673 Asserts that a given mockito build works as it should (classloader problem in 2.7) + * + * @author Kristian Rosenvold + */ +public class Surefire673MockitoIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testBuildFailingWhenErrors() + { + unpack( "/surefire-673-mockito" ).executeTest().verifyErrorFreeLog(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire674BuildFailingWhenErrorsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire674BuildFailingWhenErrorsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire674BuildFailingWhenErrorsIT.java new file mode 100644 index 0000000..5aa342f --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire674BuildFailingWhenErrorsIT.java @@ -0,0 +1,39 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * SUREFIRE-674 Asserts that the build fails when tests have errors + * + * @author Kristian Rosenvold + */ +public class Surefire674BuildFailingWhenErrorsIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testBuildFailingWhenErrors() + { + unpack( "/surefire-674-buildFailingWhenErrors" ).maven().withFailure().executeTest().verifyTextInLog( + "BUILD FAILURE" ); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire674BuildFailingWhenFailsafeErrorsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire674BuildFailingWhenFailsafeErrorsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire674BuildFailingWhenFailsafeErrorsIT.java new file mode 100644 index 0000000..57c8648 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire674BuildFailingWhenFailsafeErrorsIT.java @@ -0,0 +1,38 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * SUREFIRE-674 Asserts that the build fails when tests have errors + * + * @author Kristian Rosenvold + */ +public class Surefire674BuildFailingWhenFailsafeErrorsIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testBuildFailingWhenErrors() + { + unpack( "/failsafe-buildfail" ).maven().withFailure().executeVerify().verifyTextInLog( "BUILD FAILURE" ); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire685CommaSeparatedIncludesIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire685CommaSeparatedIncludesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire685CommaSeparatedIncludesIT.java new file mode 100644 index 0000000..3d7a684 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire685CommaSeparatedIncludesIT.java @@ -0,0 +1,38 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * SUREFIRE-685 Asserts that only the specified tests are run with comma separated includes + * + * @author Kristian Rosenvold + */ +public class Surefire685CommaSeparatedIncludesIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testBuildFailingWhenErrors() + { + executeErrorFreeTest( "/surefire-685-commaseparatedIncludes", 2 ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire697NiceSummaryIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire697NiceSummaryIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire697NiceSummaryIT.java new file mode 100644 index 0000000..3175196 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire697NiceSummaryIT.java @@ -0,0 +1,39 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * SUREFIRE-697 Asserts proper truncation of long exception messages Some say testing this is a bit over the top. + * + * @author Kristian Rosenvold + */ +public class Surefire697NiceSummaryIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testBuildFailingWhenErrors() + { + unpack( "/surefire-697-niceSummary" ).failNever().executeTest().verifyTextInLog( + "junit.surefire697.BasicTest#testShortMultiline RuntimeException A very short m" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire705ParallelForkTimeoutIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire705ParallelForkTimeoutIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire705ParallelForkTimeoutIT.java new file mode 100644 index 0000000..e1a258a --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire705ParallelForkTimeoutIT.java @@ -0,0 +1,40 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * Test + * + * @author Kristian Rosenvold + */ +public class Surefire705ParallelForkTimeoutIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testTimeoutForked() + { + unpack( "/fork-timeout" ).setJUnitVersion( "4.8.1" ).addGoal( "-Djunit.version=4.8.1" ).addGoal( + "-Djunit.parallel=classes" ).addGoal( "-DtimeOut=1" ).maven().withFailure().executeTest() + .verifyTextInLog( "There was a timeout or other error in the fork" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire733AllOverrridesCapturedIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire733AllOverrridesCapturedIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire733AllOverrridesCapturedIT.java new file mode 100644 index 0000000..aabb05d --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire733AllOverrridesCapturedIT.java @@ -0,0 +1,36 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * @author Kristian Rosenvold + */ +public class Surefire733AllOverrridesCapturedIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testLogOutput() + { + unpack( "surefire-733-allOverridesCaptured" ).executeTest().verifyTextInLog( "abc" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java new file mode 100644 index 0000000..34504c1 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire735ForkFailWithRedirectConsoleOutputIT.java @@ -0,0 +1,80 @@ +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.apache.maven.surefire.its.fixture.SurefireLauncher; +import org.junit.Test; + +import java.io.File; +import java.io.FilenameFilter; + +import static org.fest.assertions.Assertions.assertThat; + +/** + * @author Kristian Rosenvold + */ +public class Surefire735ForkFailWithRedirectConsoleOutputIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void vmStartFail() + throws Exception + { + OutputValidator outputValidator = unpack().failNever().executeTest(); + assertJvmCrashed( outputValidator ); + } + + @Test + public void vmStartFailShouldFailBuildk() + throws Exception + { + OutputValidator outputValidator = unpack().maven().withFailure().executeTest(); + assertJvmCrashed( outputValidator ); + } + + private SurefireLauncher unpack() + { + return unpack( "fork-fail" ); + } + + private static void assertJvmCrashed( OutputValidator outputValidator ) + { + File reportDir = outputValidator.getSurefireReportsDirectory(); + String[] dumpFiles = reportDir.list( new FilenameFilter() + { + @Override + public boolean accept( File dir, String name ) + { + return name.endsWith( ".dumpstream" ); + } + } + ); + assertThat( dumpFiles ).isNotEmpty(); + for ( String dump : dumpFiles ) + { + outputValidator.getSurefireReportsFile( dump ) + .assertContainsText( "Invalid maximum heap size: -Xmxxxx712743m" ); + } + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java new file mode 100644 index 0000000..e05cee7 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire740TruncatedCommaIT.java @@ -0,0 +1,48 @@ +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.apache.maven.surefire.its.fixture.TestFile; +import org.junit.Test; + +import static org.junit.Assert.assertTrue; + +/** + * Test Surefire-740 Truncated comma with non us locale + * + * @author Kristian Rosenvold + */ +public class Surefire740TruncatedCommaIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testRussianLocaleReport() + { + OutputValidator validator = unpack( "/surefire-740-comma-truncated" ).setMavenOpts( + "-Duser.language=ru -Duser.country=RU" ).failNever().addSurefireReportGoal().executeCurrentGoals(); + + TestFile siteFile = validator.getSiteFile( "surefire-report.html" ); + assertTrue( "Expecting file", siteFile.exists() ); + siteFile.assertContainsText( "027" ); // Avoid asserting with the "," or "." ;) + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire747MethodParallelWithSuiteCountIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire747MethodParallelWithSuiteCountIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire747MethodParallelWithSuiteCountIT.java new file mode 100644 index 0000000..c5dbc84 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire747MethodParallelWithSuiteCountIT.java @@ -0,0 +1,168 @@ +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.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.Before; +import org.junit.Test; + +import java.text.Format; +import java.text.NumberFormat; +import java.util.Iterator; +import java.util.Set; +import java.util.TreeSet; + +import static java.lang.String.format; +import static java.math.RoundingMode.DOWN; +import static java.util.Locale.ROOT; +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.endsWith; +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +/** + * @author Kristian Rosenvold + */ +public class Surefire747MethodParallelWithSuiteCountIT + extends SurefireJUnit4IntegrationTestCase +{ + // if you want to change his constant, change it in SuiteTest1.java and SuiteTest2.java as well + private static final int PERFORMANCE_TEST_MULTIPLICATION_FACTOR = 4; + + private Format lowerScaleFormatter, noFractionalDigitsFormatter; + + private static Set<String> printTestLines( OutputValidator validator, String pattern ) + throws VerificationException + { + Set<String> log = new TreeSet<String>( validator.loadLogLines() ); + for ( Iterator<String> it = log.iterator(); it.hasNext(); ) + { + String line = it.next(); + if ( !line.contains( pattern ) ) + { + it.remove(); + } + } + return log; + } + + private static long duration( String logLine ) + { + return Integer.decode( logLine.split( "=" )[1] ); + } + + @Before + public void init() + { + NumberFormat lowScaleFormatter = NumberFormat.getInstance( ROOT ); + lowScaleFormatter.setRoundingMode( DOWN ); + lowScaleFormatter.setMinimumFractionDigits( 1 ); + lowScaleFormatter.setMaximumFractionDigits( 1 ); + this.lowerScaleFormatter = lowScaleFormatter; + + NumberFormat noFractionalDigitsFormatter = NumberFormat.getInstance( ROOT ); + noFractionalDigitsFormatter.setRoundingMode( DOWN ); + noFractionalDigitsFormatter.setMinimumFractionDigits( 0 ); + noFractionalDigitsFormatter.setMaximumFractionDigits( 0 ); + this.noFractionalDigitsFormatter = noFractionalDigitsFormatter; + } + + @Test + public void testMethodsParallelWithSuite() + throws VerificationException + { + OutputValidator validator = unpack().executeTest().verifyErrorFree( 6 ); + Set<String> testLines = printTestLines( validator, "test finished after duration=" ); + assertThat( testLines.size(), is( 2 ) ); + for ( String testLine : testLines ) + { + long duration = duration( testLine ); + long min = 250 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR; + long max = 750 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR; + assertTrue( format( "duration %d should be between %d and %d ms", duration, min, max ), + duration > min && duration < max + ); + } + Set<String> suiteLines = printTestLines( validator, "suite finished after duration=" ); + assertThat( suiteLines.size(), is( 1 ) ); + long duration = duration( suiteLines.iterator().next() ); + long min = 750 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR; + long max = 1250 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR; + assertTrue( format( "duration %d should be between %d and %d ms", duration, min, max ), + duration > min && duration < max + ); + + String delayMin = lowerScaleFormatter.format( 0.98 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR * 0.5 ); + String delayMax = noFractionalDigitsFormatter.format( PERFORMANCE_TEST_MULTIPLICATION_FACTOR * 0.5 ) + "."; + + for ( String line : validator.loadLogLines() ) + { + if ( line.startsWith( "Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:" ) ) + { + assertThat( line, anyOf( // 1.9xx to 2.xxx can vary depending on CI jobs + containsString( "Time elapsed: " + delayMin ), + containsString( "Time elapsed: " + delayMax ) + ) + ); + assertThat( line, anyOf( + endsWith( " s - in surefire747.SuiteTest1" ), + endsWith( " s - in surefire747.SuiteTest2" ) + ) + ); + } + } + } + + @Test + public void testClassesParallelWithSuite() + throws VerificationException + { + OutputValidator validator = unpack().parallelClasses().executeTest().verifyErrorFree( 6 ); + Set<String> testLines = printTestLines( validator, "test finished after duration=" ); + assertThat( testLines.size(), is( 2 ) ); + for ( String testLine : testLines ) + { + long duration = duration( testLine ); + long min = 1450 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR; + long max = 1750 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR; + assertTrue( format( "duration %d should be between %d and %d ms", duration, min, max ), + duration > min && duration < max + ); + } + Set<String> suiteLines = printTestLines( validator, "suite finished after duration=" ); + assertThat( suiteLines.size(), is( 1 ) ); + long duration = duration( suiteLines.iterator().next() ); + long min = 1450 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR; + long max = 1750 * PERFORMANCE_TEST_MULTIPLICATION_FACTOR; + assertTrue( format( "duration %d should be between %d and %d ms", duration, min, max ), + duration > min && duration < max + ); + } + + public SurefireLauncher unpack() + { + return unpack( "junit47-parallel-with-suite" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772BothReportsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772BothReportsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772BothReportsIT.java new file mode 100644 index 0000000..96d31c1 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772BothReportsIT.java @@ -0,0 +1,87 @@ +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.*; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * Test Surefire-740 Truncated comma with non us locale + * + * @author Kristian Rosenvold + */ +public class Surefire772BothReportsIT + extends SurefireJUnit4IntegrationTestCase +{ + + public SurefireLauncher unpack() + { + SurefireLauncher unpack = unpack( "/surefire-772-both-reports" ); + unpack.maven().deleteSiteDir().skipClean().failNever(); + return unpack; + } + + @Test + public void testReportGeneration() + throws Exception + { + OutputValidator outputValidator = + unpack().addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + TestFile siteFile = outputValidator.getSiteFile( "surefire-report.html" ); + assertTrue( "Expecting surefire report file", siteFile.isFile() ); + + siteFile = outputValidator.getSiteFile( "failsafe-report.html" ); + assertTrue( "Expecting failsafe report file", siteFile.isFile() ); + } + + @Test + public void testSkippedFailsafeReportGeneration() + throws Exception + { + OutputValidator validator = unpack(). + activateProfile( + "skipFailsafe" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + TestFile siteFile = validator.getSiteFile( "surefire-report.html" ); + assertTrue( "Expecting surefire report file", siteFile.isFile() ); + + siteFile = validator.getSiteFile( "failsafe-report.html" ); + assertFalse( "Expecting no failsafe report file", siteFile.isFile() ); + } + + @Test + public void testSkippedSurefireReportGeneration() + throws Exception + { + OutputValidator validator = unpack().failNever(). + activateProfile( + "skipSurefire" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + TestFile siteFile = validator.getSiteFile( "surefire-report.html" ); + assertFalse( "Expecting no surefire report file", siteFile.isFile() ); + + siteFile = validator.getSiteFile( "failsafe-report.html" ); + assertTrue( "Expecting failsafe report file", siteFile.isFile() ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoFailsafeReportsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoFailsafeReportsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoFailsafeReportsIT.java new file mode 100644 index 0000000..af18336 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoFailsafeReportsIT.java @@ -0,0 +1,108 @@ +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 java.io.IOException; +import org.apache.maven.it.VerificationException; +import org.apache.maven.surefire.its.fixture.*; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * Test Surefire-740 Truncated comma with non us locale + * + * @author Kristian Rosenvold + */ +public class Surefire772NoFailsafeReportsIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void testReportGeneration() + throws Exception + { + final OutputValidator site = + unpack().addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + assertSurefireReportPresent( site ); + assertNoFailsefeReport( site ); + } + + @Test + public void testSkippedFailsafeReportGeneration() + throws Exception + { + final OutputValidator validator = unpack().activateProfile( + "skipFailsafe" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + assertSurefireReportPresent( validator ); + assertNoFailsefeReport( validator ); + + } + + @Test + public void testForcedFailsafeReportGeneration() + throws Exception + { + final OutputValidator validator = unpack().activateProfile( + "forceFailsafe" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + assertSurefireReportPresent( validator ); + assertFailsafeReport( validator ); + } + + @Test + public void testSkipForcedFailsafeReportGeneration() + throws Exception + { + final OutputValidator validator = unpack().activateProfile( "forceFailsafe" ).activateProfile( + "skipFailsafe" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + assertSurefireReportPresent( validator ); + assertNoFailsefeReport( validator ); + } + + private void assertNoFailsefeReport( OutputValidator site ) + { + TestFile siteFile = site.getSiteFile( "failsafe-report.html" ); + assertFalse( "Expecting no failsafe report file", siteFile.isFile() ); + } + + private void assertFailsafeReport( OutputValidator site ) + { + TestFile siteFile = site.getSiteFile( "failsafe-report.html" ); + assertTrue( "Expecting no failsafe report file", siteFile.isFile() ); + } + + private void assertSurefireReportPresent( OutputValidator site ) + { + TestFile siteFile = site.getSiteFile( "surefire-report.html" ); + assertTrue( "Expecting surefire report file", siteFile.isFile() ); + } + + private SurefireLauncher unpack() + throws VerificationException, IOException + { + final SurefireLauncher unpack = unpack( "surefire-772-no-failsafe-reports" ); + unpack.maven().deleteSiteDir().skipClean().failNever().assertNotPresent( "site" ); + return unpack; + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoSurefireReportsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoSurefireReportsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoSurefireReportsIT.java new file mode 100644 index 0000000..6b59ba2 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772NoSurefireReportsIT.java @@ -0,0 +1,98 @@ +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.apache.maven.surefire.its.fixture.SurefireLauncher; +import org.apache.maven.surefire.its.fixture.TestFile; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * Test Surefire-740 Truncated comma with non us locale + * + * @author Kristian Rosenvold + */ +public class Surefire772NoSurefireReportsIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testReportGeneration() + { + OutputValidator validator = + unpack().addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + TestFile siteFile = validator.getSiteFile( "surefire-report.html" ); + assertTrue( "Expecting surefire report file", siteFile.isFile() ); + + siteFile = validator.getSiteFile( "failsafe-report.html" ); + assertTrue( "Expecting failsafe report file", siteFile.isFile() ); + } + + @Test + public void testSkippedSurefireReportGeneration() + { + OutputValidator validator = unpack().activateProfile( + "skipSurefire" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + TestFile siteFile = validator.getSiteFile( "surefire-report.html" ); + assertFalse( "Expecting no surefire report file", siteFile.isFile() ); + + siteFile = validator.getSiteFile( "failsafe-report.html" ); + assertTrue( "Expecting failsafe report file", siteFile.isFile() ); + } + + @Test + public void testOptionalSurefireReportGeneration() + { + OutputValidator validator = unpack().activateProfile( + "optionalSurefire" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + TestFile siteFile = validator.getSiteFile( "surefire-report.html" ); + assertFalse( "Expecting no surefire report file", siteFile.isFile() ); + + siteFile = validator.getSiteFile( "failsafe-report.html" ); + assertTrue( "Expecting failsafe report file", siteFile.isFile() ); + } + + @Test + public void testSkipOptionalSurefireReportGeneration() + { + OutputValidator validator = unpack().activateProfile( "optionalSurefire" ).activateProfile( + "skipSurefire" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + TestFile siteFile = validator.getSiteFile( "surefire-report.html" ); + assertFalse( "Expecting no surefire report file", siteFile.isFile() ); + + siteFile = validator.getSiteFile( "failsafe-report.html" ); + assertTrue( "Expecting failsafe report file", siteFile.isFile() ); + } + + public SurefireLauncher unpack() + { + SurefireLauncher unpack = unpack( "/surefire-772-no-surefire-reports" ); + unpack.maven().failNever().deleteSiteDir().skipClean( ); + return unpack; + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772SpecifiedReportsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772SpecifiedReportsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772SpecifiedReportsIT.java new file mode 100644 index 0000000..a709f7d --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire772SpecifiedReportsIT.java @@ -0,0 +1,82 @@ +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.*; +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * Test Surefire-740 Truncated comma with non us locale + * + * @author Kristian Rosenvold + */ +public class Surefire772SpecifiedReportsIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testReportGeneration() + { + OutputValidator validator = + unpack().addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + TestFile siteFile = validator.getSiteFile( "surefire-report.html" ); + assertTrue( "Expecting surefire report file", siteFile.isFile() ); + + siteFile = validator.getSiteFile( "failsafe-report.html" ); + assertTrue( "Expecting failsafe report file", siteFile.isFile() ); + } + + @Test + public void testSkippedFailsafeReportGeneration() + { + OutputValidator validator = unpack().activateProfile( + "skipFailsafe" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + TestFile siteFile = validator.getSiteFile( "surefire-report.html" ); + assertTrue( "Expecting surefire report file", siteFile.isFile() ); + + siteFile = validator.getSiteFile( "failsafe-report.html" ); + assertFalse( "Expecting no failsafe report file", siteFile.isFile() ); + } + + @Test + public void testSkippedSurefireReportGeneration() + { + OutputValidator validator = unpack().activateProfile( + "skipSurefire" ).addFailsafeReportOnlyGoal().addSurefireReportOnlyGoal().executeCurrentGoals(); + + TestFile siteFile = validator.getSiteFile( "surefire-report.html" ); + assertFalse( "Expecting no surefire report file", siteFile.isFile() ); + + siteFile = validator.getSiteFile( "failsafe-report.html" ); + assertTrue( "Expecting failsafe report file", siteFile.isFile() ); + } + + public SurefireLauncher unpack() + { + SurefireLauncher unpack = unpack( "/surefire-772-specified-reports" ); + unpack.maven().deleteSiteDir().skipClean().failNever(); + return unpack; + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire801ForkModeNoneClassLoaderIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire801ForkModeNoneClassLoaderIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire801ForkModeNoneClassLoaderIT.java new file mode 100644 index 0000000..910cfc5 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire801ForkModeNoneClassLoaderIT.java @@ -0,0 +1,38 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * Test + * + * @author Kristian Rosenvold + */ +public class Surefire801ForkModeNoneClassLoaderIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testSHouldBeOkWithForkNever() + { + unpack( "fork-mode-resource-loading" ).forkNever().executeTest(); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire803MultiFailsafeExecsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire803MultiFailsafeExecsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire803MultiFailsafeExecsIT.java new file mode 100644 index 0000000..658befd --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire803MultiFailsafeExecsIT.java @@ -0,0 +1,47 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.apache.maven.surefire.its.fixture.SurefireLauncher; +import org.junit.Test; + +public class Surefire803MultiFailsafeExecsIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void testSecondExecutionRunsAfterFirstExecutionFails() + { + unpack( + "/surefire-803-multiFailsafeExec-failureInFirst" ).maven().withFailure().executeVerify().assertIntegrationTestSuiteResults( + 4, 0, 2, 0 ); + } + + @Test + public void testOneExecutionRunInTwoBuilds() + { + SurefireLauncher launcher = unpack( "/surefire-803-multiFailsafeExec-rebuildOverwrites" ); + launcher.sysProp( "success", "false" ).maven().withFailure().executeVerify().assertIntegrationTestSuiteResults( + 1, 0, 1, 0 ); + launcher.reset(); + launcher.sysProp( "success", "true" ).executeVerify().assertIntegrationTestSuiteResults( 1, 0, 0, 0 ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java new file mode 100644 index 0000000..aedb82b --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire806SpecifiedTestControlsIT.java @@ -0,0 +1,52 @@ +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.SurefireJUnit4IntegrationTestCase; + +import org.junit.Ignore; +import org.junit.Test; + +public class Surefire806SpecifiedTestControlsIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + @Ignore( "since SUREFIRE-1153 the includes/excludes are overridden by -Dtest or it.test for whatever execution" ) + public void singleTestInOneExecutionOfMultiExecutionProject() + { + unpack( "/surefire-806-specifiedTests-multi" ).setTestToRun( "FirstTest" ).failIfNoSpecifiedTests( + false ).executeTest().verifyErrorFree( 1 ); + } + + @Test + @Ignore( "since SUREFIRE-1153 the includes/excludes are overridden by -Dtest or it.test for whatever execution" ) + public void twoSpecifiedTestExecutionsInCorrectExecutionBlocks() + { + unpack( "/surefire-806-specifiedTests-multi" ).setTestToRun( + "FirstTest,SecondTest" ).executeTest().verifyErrorFree( 2 ); + } + + @Test + public void singleTestInSingleExecutionProject() + { + unpack( "/surefire-806-specifiedTests-single" ).setTestToRun( "ThirdTest" ).failIfNoSpecifiedTests( + false ).executeTest().verifyErrorFree( 1 ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire809GroupExpressionsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire809GroupExpressionsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire809GroupExpressionsIT.java new file mode 100755 index 0000000..5ab103b --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire809GroupExpressionsIT.java @@ -0,0 +1,114 @@ +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.apache.maven.surefire.its.fixture.SurefireLauncher; + +import org.junit.Test; + +public class Surefire809GroupExpressionsIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void categoryAB() + { + OutputValidator validator = unpackJUnit().groups( "junit4.CategoryA AND junit4.CategoryB" ).executeTest(); + validator.verifyErrorFreeLog(); + validator.assertTestSuiteResults( 2, 0, 0, 0 ); + validator.verifyTextInLog( "catA: 1" ); + validator.verifyTextInLog( "catB: 1" ); + validator.verifyTextInLog( "catC: 0" ); + validator.verifyTextInLog( "catNone: 0" ); + validator.verifyTextInLog( "mA: 1" ); + validator.verifyTextInLog( "mB: 1" ); + validator.verifyTextInLog( "mC: 0" ); + } + + @Test + public void incorrectJUnitVersions() + { + unpackJUnit().setJUnitVersion( "4.5" ).groups( + "junit4.CategoryA AND junit4.CategoryB" ).maven().withFailure().executeTest(); + } + + @Test + public void testJUnitRunCategoryNotC() + { + OutputValidator validator = unpackJUnit().groups( "!junit4.CategoryC" ).executeTest(); + validator.verifyErrorFreeLog(); + validator.assertTestSuiteResults( 5, 0, 0, 0 ); + validator.verifyTextInLog( "catA: 2" ); + validator.verifyTextInLog( "catB: 2" ); + validator.verifyTextInLog( "catC: 0" ); + validator.verifyTextInLog( "catNone: 1" ); + validator.verifyTextInLog( "NoCategoryTest.CatNone: 1" ); + } + + @Test + public void testExcludedGroups() + { + OutputValidator validator = unpackJUnit().setExcludedGroups( "junit4.CategoryC" ).executeTest(); + validator.verifyErrorFreeLog(); + validator.assertTestSuiteResults( 5, 0, 0, 0 ); + validator.verifyTextInLog( "catA: 2" ); + validator.verifyTextInLog( "catB: 2" ); + validator.verifyTextInLog( "catC: 0" ); + validator.verifyTextInLog( "catNone: 1" ); + validator.verifyTextInLog( "NoCategoryTest.CatNone: 1" ); + } + + @Test + public void testNGRunCategoryAB() + { + OutputValidator validator = unpackTestNG().groups( "CategoryA AND CategoryB" ).debugLogging().executeTest(); + validator.verifyErrorFreeLog(); + validator.assertTestSuiteResults( 2, 0, 0, 0 ); + validator.verifyTextInLog( "BasicTest.testInCategoriesAB()" ); + validator.verifyTextInLog( "CategoryCTest.testInCategoriesAB()" ); + } + + @Test + public void testNGRunCategoryNotC() + { + OutputValidator validator = unpackTestNG().groups( "!CategoryC" ).debugLogging().executeTest(); + validator.verifyErrorFreeLog(); + validator.assertTestSuiteResults( 8, 0, 0, 0 ); + validator.verifyTextInLog( "catA: 2" ); + validator.verifyTextInLog( "catB: 2" ); + validator.verifyTextInLog( "catC: 0" ); + validator.verifyTextInLog( "catNone: 1" ); + validator.verifyTextInLog( "mA: 2" ); + validator.verifyTextInLog( "mB: 2" ); + validator.verifyTextInLog( "mC: 0" ); + validator.verifyTextInLog( "NoCategoryTest.CatNone: 1" ); + } + + private SurefireLauncher unpackJUnit() + { + return unpack( "surefire-809-groupExpr-junit48" ); + } + + private SurefireLauncher unpackTestNG() + { + return unpack( "surefire-809-groupExpr-testng" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire812Log4JClassLoaderIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire812Log4JClassLoaderIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire812Log4JClassLoaderIT.java new file mode 100644 index 0000000..065ec19 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire812Log4JClassLoaderIT.java @@ -0,0 +1,36 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * @author Kristian Rosenvold + */ +public class Surefire812Log4JClassLoaderIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testJunit3ParallelBuildResultCount() + { + executeErrorFreeTest( "surefire-812-log4j-classloader", 1 ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire817SystemExitIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire817SystemExitIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire817SystemExitIT.java new file mode 100644 index 0000000..215bd5d --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire817SystemExitIT.java @@ -0,0 +1,47 @@ +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.it.VerificationException; +import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; +import org.apache.maven.surefire.its.fixture.SurefireLauncher; +import org.junit.Test; + +/** + * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> + * @see <a href="https://issues.apache.org/jira/browse/SUREFIRE-817">SUREFIRE-817</a> + * @since 2.18 + */ +public class Surefire817SystemExitIT + extends SurefireJUnit4IntegrationTestCase +{ + + @Test + public void systemExit1() + throws VerificationException + { + unpack().maven().withFailure().executeTest().verifyTextInLog( "class jiras.surefire817.Test main" ); + } + + private SurefireLauncher unpack() + { + return unpack( "surefire-817-system-exit" ); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire818NpeIgnoresTestsIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire818NpeIgnoresTestsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire818NpeIgnoresTestsIT.java new file mode 100644 index 0000000..1bf4c8d --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire818NpeIgnoresTestsIT.java @@ -0,0 +1,39 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * SUREFIRE-818 + * + * @author Kristian Rosenvold + */ +public class Surefire818NpeIgnoresTestsIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testBuildFailingWhenErrors() + { + unpack( "surefire-818-ignored-tests-on-npe" ).maven().withFailure().executeTest().assertTestSuiteResults( 2, 0, + 1, 0 ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire828EmptyGroupExprIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire828EmptyGroupExprIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire828EmptyGroupExprIT.java new file mode 100644 index 0000000..b59bc6a --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire828EmptyGroupExprIT.java @@ -0,0 +1,97 @@ +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.apache.maven.surefire.its.fixture.SurefireLauncher; +import org.junit.Test; + +public class Surefire828EmptyGroupExprIT + extends SurefireJUnit4IntegrationTestCase +{ + // !CategoryC + @Test + public void testJUnitRunEmptyGroups() + { + OutputValidator validator = unpackJUnit().sysProp( "profile", "emptyGroups" ).executeTest(); + validator.verifyErrorFreeLog(); + validator.assertTestSuiteResults( 5, 0, 0, 0 ); + validator.verifyTextInLog( "catA: 2" ); + validator.verifyTextInLog( "catB: 2" ); + validator.verifyTextInLog( "catC: 0" ); + validator.verifyTextInLog( "catNone: 1" ); + validator.verifyTextInLog( "NoCategoryTest.CatNone: 1" ); + } + + // CategoryA && CategoryB + @Test + public void testJUnitRunEmptyExcludeGroups() + { + OutputValidator validator = unpackJUnit().sysProp( "profile", "emptyExcludedGroups" ).executeTest(); + validator.verifyErrorFreeLog(); + validator.assertTestSuiteResults( 2, 0, 0, 0 ); + validator.verifyTextInLog( "catA: 1" ); + validator.verifyTextInLog( "catB: 1" ); + validator.verifyTextInLog( "catC: 0" ); + validator.verifyTextInLog( "catNone: 0" ); + validator.verifyTextInLog( "mA: 1" ); + validator.verifyTextInLog( "mB: 1" ); + validator.verifyTextInLog( "mC: 0" ); + } + + // CategoryA && CategoryB + @Test + public void testTestNGRunEmptyExcludeGroups() + { + OutputValidator validator = unpackTestNG().sysProp( "profile", "emptyExcludedGroups" ).executeTest(); + validator.verifyErrorFreeLog(); + validator.assertTestSuiteResults( 2, 0, 0, 0 ); + validator.verifyTextInLog( "BasicTest.testInCategoriesAB()" ); + validator.verifyTextInLog( "CategoryCTest.testInCategoriesAB()" ); + } + + // !CategoryC + @Test + public void testTestNGRunEmptyGroups() + { + OutputValidator validator = unpackTestNG().sysProp( "profile", "emptyGroups" ).executeTest(); + validator.verifyErrorFreeLog(); + validator.assertTestSuiteResults( 8, 0, 0, 0 ); + validator.verifyTextInLog( "catA: 2" ); + validator.verifyTextInLog( "catB: 2" ); + validator.verifyTextInLog( "catC: 0" ); + validator.verifyTextInLog( "catNone: 1" ); + validator.verifyTextInLog( "mA: 2" ); + validator.verifyTextInLog( "mB: 2" ); + validator.verifyTextInLog( "mC: 0" ); + validator.verifyTextInLog( "NoCategoryTest.CatNone: 1" ); + } + + private SurefireLauncher unpackJUnit() + { + return unpack( "surefire-828-emptyGroupExpr-junit48" ); + } + + private SurefireLauncher unpackTestNG() + { + return unpack( "surefire-828-emptyGroupExpr-testng" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire832ProviderSelectionIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire832ProviderSelectionIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire832ProviderSelectionIT.java new file mode 100755 index 0000000..c694a3d --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire832ProviderSelectionIT.java @@ -0,0 +1,49 @@ +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.apache.maven.surefire.its.fixture.SurefireLauncher; +import org.junit.Test; + +public class Surefire832ProviderSelectionIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testJUnitRunCategoryAB() + { + OutputValidator validator = unpackJUnit().groups( "junit4.CategoryA AND junit4.CategoryB" ).executeTest(); + validator.verifyErrorFreeLog(); + validator.assertTestSuiteResults( 2, 0, 0, 0 ); + validator.verifyTextInLog( "catA: 1" ); + validator.verifyTextInLog( "catB: 1" ); + validator.verifyTextInLog( "catC: 0" ); + validator.verifyTextInLog( "catNone: 0" ); + validator.verifyTextInLog( "mA: 1" ); + validator.verifyTextInLog( "mB: 1" ); + validator.verifyTextInLog( "mC: 0" ); + } + + private SurefireLauncher unpackJUnit() + { + return unpack( "surefire-832-provider-selection" ); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire839TestWithoutCategoriesIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire839TestWithoutCategoriesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire839TestWithoutCategoriesIT.java new file mode 100755 index 0000000..0babe66 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire839TestWithoutCategoriesIT.java @@ -0,0 +1,45 @@ +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.SurefireJUnit4IntegrationTestCase; + +import org.junit.Test; + +public class Surefire839TestWithoutCategoriesIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void classWithoutCategory() + { + unpack( "junit48-categories" ).setJUnitVersion( "4.11" ).executeTest().verifyErrorFree( 3 ); + } + + @Test + public void classWithoutCategoryForked() + { + unpack( "junit48-categories" ) + .setJUnitVersion( "4.11" ) + .forkPerThread() + .reuseForks( true ) + .threadCount( 2 ) + .executeTest() + .verifyErrorFree( 3 ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire847AdditionalFailureIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire847AdditionalFailureIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire847AdditionalFailureIT.java new file mode 100755 index 0000000..eaecc90 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire847AdditionalFailureIT.java @@ -0,0 +1,33 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +public class Surefire847AdditionalFailureIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void testJUnitRunCategoryAB() + { + unpack( "surefire-847-testngfail" ).setTestToRun( + "org/codehaus/SomePassedTest" ).executeTest().verifyErrorFreeLog(); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire855AllowFailsafeUseArtifactFileIT.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire855AllowFailsafeUseArtifactFileIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire855AllowFailsafeUseArtifactFileIT.java new file mode 100644 index 0000000..1263ab3 --- /dev/null +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire855AllowFailsafeUseArtifactFileIT.java @@ -0,0 +1,58 @@ +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.SurefireJUnit4IntegrationTestCase; +import org.junit.Test; + +/** + * @author <a href="mailto:tibordig...@apache.org">Tibor Digana (tibor17)</a> + * @see <a href="https://issues.apache.org/jira/browse/SUREFIRE-855">SUREFIRE-855</a> + * @since 2.19 + */ +public class Surefire855AllowFailsafeUseArtifactFileIT + extends SurefireJUnit4IntegrationTestCase +{ + @Test + public void warShouldUseClasses() + { + unpack( "surefire-855-failsafe-use-war" ).maven().executeVerify().verifyErrorFree( 2 ); + } + + @Test + public void jarShouldUseFile() + { + unpack( "surefire-855-failsafe-use-jar" ) + .maven().sysProp( "forkMode", "once" ).executeVerify().assertIntegrationTestSuiteResults( 3, 0, 0, 1 ); + } + + @Test + public void jarNotForkingShouldUseFile() + { + unpack( "surefire-855-failsafe-use-jar" ) + .maven().sysProp( "forkMode", "never" ).executeVerify().assertIntegrationTestSuiteResults( 3, 0, 0, 1 ); + } + + @Test + public void osgiBundleShouldUseFile() + { + unpack( "surefire-855-failsafe-use-bundle" ).maven().executeVerify().verifyErrorFree( 2 ); + } +} \ No newline at end of file