http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-parallel/src/test/java/surefireparallel/Waiting7Test.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-parallel/src/test/java/surefireparallel/Waiting7Test.java b/surefire-its/src/test/resources/junit47-parallel/src/test/java/surefireparallel/Waiting7Test.java new file mode 100644 index 0000000..ca00a6a --- /dev/null +++ b/surefire-its/src/test/resources/junit47-parallel/src/test/java/surefireparallel/Waiting7Test.java @@ -0,0 +1,50 @@ +package surefireparallel; + +/* + * 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; + +/** + * @author Tibor Digana (tibor17) + * @since 2.16 + */ +public class Waiting7Test +{ + @Test + public void a() + throws InterruptedException + { + Thread.sleep( 300L ); + } + + @Test + public void b() + throws InterruptedException + { + Thread.sleep( 300L ); + } + + @Test + public void c() + throws InterruptedException + { + Thread.sleep( 300L ); + } +} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-parallel/src/test/java/surefireparallel/Waiting8Test.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-parallel/src/test/java/surefireparallel/Waiting8Test.java b/surefire-its/src/test/resources/junit47-parallel/src/test/java/surefireparallel/Waiting8Test.java new file mode 100644 index 0000000..96d1c66 --- /dev/null +++ b/surefire-its/src/test/resources/junit47-parallel/src/test/java/surefireparallel/Waiting8Test.java @@ -0,0 +1,50 @@ +package surefireparallel; + +/* + * 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; + +/** + * @author Tibor Digana (tibor17) + * @since 2.16 + */ +public class Waiting8Test +{ + @Test + public void a() + throws InterruptedException + { + Thread.sleep( 300L ); + } + + @Test + public void b() + throws InterruptedException + { + Thread.sleep( 300L ); + } + + @Test + public void c() + throws InterruptedException + { + Thread.sleep( 300L ); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-redirect-output/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-redirect-output/pom.xml b/surefire-its/src/test/resources/junit47-redirect-output/pom.xml new file mode 100644 index 0000000..38ec727 --- /dev/null +++ b/surefire-its/src/test/resources/junit47-redirect-output/pom.xml @@ -0,0 +1,58 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>fork-consoleOutput</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>fork-consoleOutput</name> + <url>http://maven.apache.org</url> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + <configuration> + <forkMode>${forkMode}</forkMode> + <printSummary>${printSummary}</printSummary> + <useFile>true</useFile> + <redirectTestOutputToFile>${redirect.to.file}</redirectTestOutputToFile> + <threadCount>2</threadCount> + <parallel>${parallel}</parallel> + <runOrder>alphabetical</runOrder> + <includes> + <include>**/Test*.java</include> + </includes> + </configuration> + </plugin> + </plugins> + + </build> + + <properties> + <junit.version>4.8.1</junit.version> + <redirect.to.file>true</redirect.to.file> + <forkMode>once</forkMode> + <printSummary>true</printSummary> + <parallel>none</parallel> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test0.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test0.java b/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test0.java new file mode 100644 index 0000000..102faaa --- /dev/null +++ b/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test0.java @@ -0,0 +1,63 @@ +package junit47ConsoleOutput; + +/* + * 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.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +public class Test0 { + + public Test0(){ + System.out.println("Constructor"); + } + + @Test + public void testT0() throws Exception { + System.out.println("testT0"); + } + + @Test + public void testT1() throws Exception { + System.out.println("testT1"); + } + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + System.out.println("setUpBeforeClass"); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + System.out.println("tearDownAfterClass"); + } + + @Before + public void setUp() throws Exception { + System.out.println("setUp"); + } + + @After + public void tearDown() throws Exception { + System.out.println("tearDown"); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test1.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test1.java b/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test1.java new file mode 100644 index 0000000..40e084e --- /dev/null +++ b/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test1.java @@ -0,0 +1,43 @@ +package junit47ConsoleOutput; + +/* + * 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.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class Test1 +{ + @Test + public void test6281() { + System.out.println( "Test1 on" + Thread.currentThread().getName()); + } + + @BeforeClass + public static void testWithFailingAssumption2() { + System.out.println( "BeforeTest1 on" + Thread.currentThread().getName()); + } + + @AfterClass + public static void testWithFailingAssumption3() { + System.out.println( "AfterTest1 on" + Thread.currentThread().getName()); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test2.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test2.java b/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test2.java new file mode 100644 index 0000000..1a14fc7 --- /dev/null +++ b/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test2.java @@ -0,0 +1,43 @@ +package junit47ConsoleOutput; + +/* + * 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.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class Test2 +{ + @Test + public void test6281() { + System.out.println( "Test2 on" + Thread.currentThread().getName()); + } + + @BeforeClass + public static void testWithFailingAssumption2() { + System.out.println( "BeforeTest2 on" + Thread.currentThread().getName()); + } + + @AfterClass + public static void testWithFailingAssumption3() { + System.out.println( "AfterTest2 on" + Thread.currentThread().getName()); + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test3.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test3.java b/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test3.java new file mode 100644 index 0000000..35b0032 --- /dev/null +++ b/surefire-its/src/test/resources/junit47-redirect-output/src/test/java/junit47ConsoleOutput/Test3.java @@ -0,0 +1,30 @@ +package junit47ConsoleOutput; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.junit.Test; + +public class Test3 +{ + @Test + public void test3() { + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/pom.xml b/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/pom.xml new file mode 100644 index 0000000..24ee294 --- /dev/null +++ b/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/pom.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + </parent> + + <artifactId>junit47-rerun-failing-tests-with-cucumber</artifactId> + <name>Test for rerun failing cucumber tests in JUnit 47</name> + + <properties> + <cucumber.version>2.0.0</cucumber.version> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.cucumber</groupId> + <artifactId>cucumber-java</artifactId> + <version>${cucumber.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.cucumber</groupId> + <artifactId>cucumber-junit</artifactId> + <version>${cucumber.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/java/org/sample/cucumber/FlakeCucumberTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/java/org/sample/cucumber/FlakeCucumberTest.java b/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/java/org/sample/cucumber/FlakeCucumberTest.java new file mode 100644 index 0000000..ecda87b --- /dev/null +++ b/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/java/org/sample/cucumber/FlakeCucumberTest.java @@ -0,0 +1,29 @@ +/* + * 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. + */ + +package org.sample.cucumber; + +import cucumber.api.junit.Cucumber; +import org.junit.runner.RunWith; + +@RunWith( Cucumber.class ) +public class FlakeCucumberTest +{ + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/java/org/sample/cucumber/StepDefs.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/java/org/sample/cucumber/StepDefs.java b/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/java/org/sample/cucumber/StepDefs.java new file mode 100644 index 0000000..d253222 --- /dev/null +++ b/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/java/org/sample/cucumber/StepDefs.java @@ -0,0 +1,56 @@ +/* + * 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. + */ + +package org.sample.cucumber; + +import cucumber.api.java.en.Given; +import cucumber.api.java.en.Then; +import cucumber.api.java.en.When; + +import static org.junit.Assert.fail; + +public class StepDefs +{ + private static int testFailures = 0; + + @Given( "^I have some code$" ) + public void I_have_some_code() + throws Throwable + { + // do nothing + } + + @When( "^I run test$" ) + public void I_run_test() + throws Throwable + { + // do nothing + } + + @Then( "^I get a flake$" ) + public void I_get_a_flake() + throws Throwable + { + // This test will error out with only one retry, but will pass with two + if( testFailures < 2 ) { + testFailures++; + fail( "failing the test on purpose." ); + } + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/resources/org/sample/cucumber/Sample.feature ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/resources/org/sample/cucumber/Sample.feature b/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/resources/org/sample/cucumber/Sample.feature new file mode 100644 index 0000000..d5b5dac --- /dev/null +++ b/surefire-its/src/test/resources/junit47-rerun-failing-tests-with-cucumber/src/test/resources/org/sample/cucumber/Sample.feature @@ -0,0 +1,10 @@ +Feature: Sample + + In order to use Maven + As a user + I want to do tests. + + Scenario: Do a flake test + Given I have some code + When I run test + Then I get a flake http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml b/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml new file mode 100644 index 0000000..81f26c2 --- /dev/null +++ b/surefire-its/src/test/resources/junit47-static-inner-class-tests/pom.xml @@ -0,0 +1,40 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>junit4-test</artifactId> + <packaging>jar</packaging> + <version>1.0-SNAPSHOT</version> + <name>junit47-static-inner-class-tests</name> + <url>http://maven.apache.org</url> + <properties> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.1</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <forkMode>never</forkMode> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/BasicTest.java b/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/BasicTest.java new file mode 100644 index 0000000..f11de6d --- /dev/null +++ b/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/BasicTest.java @@ -0,0 +1,33 @@ +package junit4; + +/* + * 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 org.junit.experimental.runners.Enclosed; +import org.junit.runner.RunWith; + +@RunWith(Enclosed.class) +public class BasicTest { + public static class InnerTest { + @Test + public void testSomething() { + } + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/TopLevelAbstractClassTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/TopLevelAbstractClassTest.java b/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/TopLevelAbstractClassTest.java new file mode 100644 index 0000000..b47e755 --- /dev/null +++ b/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/TopLevelAbstractClassTest.java @@ -0,0 +1,33 @@ +package junit4; + +/* + * 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 org.junit.experimental.runners.Enclosed; +import org.junit.runner.RunWith; + +@RunWith(Enclosed.class) +public abstract class TopLevelAbstractClassTest { + public static class InnerTest { + @Test + public void testSomething() { + } + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/TopLevelInterfaceTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/TopLevelInterfaceTest.java b/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/TopLevelInterfaceTest.java new file mode 100644 index 0000000..eaa6756 --- /dev/null +++ b/surefire-its/src/test/resources/junit47-static-inner-class-tests/src/test/java/junit4/TopLevelInterfaceTest.java @@ -0,0 +1,33 @@ +package junit4; + +/* + * 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 org.junit.experimental.runners.Enclosed; +import org.junit.runner.RunWith; + +@RunWith(Enclosed.class) +public interface TopLevelInterfaceTest { + public static class InnerTest { + @Test + public void testSomething() { + } + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-categories/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-categories/pom.xml b/surefire-its/src/test/resources/junit48-categories/pom.xml new file mode 100644 index 0000000..a83b687 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-categories/pom.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>junit4</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for JUnit 4.8.1</name> + + + <properties> + <junit.version>4.8.1</junit.version> + <groups>junit4.CategoryA,junit4.CategoryB</groups> + <excludedGroups></excludedGroups> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <groups>${groups}</groups> + <excludedGroups>${excludedGroups}</excludedGroups> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/BasicTest.java b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/BasicTest.java new file mode 100644 index 0000000..3108e1a --- /dev/null +++ b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/BasicTest.java @@ -0,0 +1,72 @@ +package junit4; +/* + * 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.AfterClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; + + +public class BasicTest +{ + static int catACount = 0; + static int catBCount = 0; + static int catCCount = 0; + static int catNoneCount = 0; + + @Test + @Category(CategoryA.class) + public void testInCategoryA() + { + System.out.println( "Ran testInCategoryA" ); + catACount++; + } + + @Test + @Category(CategoryB.class) + public void testInCategoryB() + { + System.out.println( "Ran testInCategoryB" ); + catBCount++; + } + + @Test + @Category(CategoryC.class) + public void testInCategoryC() + { + System.out.println( "Ran testInCategoryC" ); + catCCount++; + } + + @Test + public void testInNoCategory() + { + System.out.println( "Ran testInNoCategory" ); + catNoneCount++; + } + + @AfterClass + public static void oneTimeTearDown() + { + System.out.println("catA: " + catACount + "\n" + + "catB: " + catBCount + "\n" + + "catC: " + catCCount + "\n" + + "catNone: " + catNoneCount); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryA.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryA.java b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryA.java new file mode 100644 index 0000000..9b8b855 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryA.java @@ -0,0 +1,21 @@ +package junit4; +/* + * 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. + */ + +interface CategoryA {} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryB.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryB.java b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryB.java new file mode 100644 index 0000000..f10f3b1 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryB.java @@ -0,0 +1,21 @@ +package junit4; +/* + * 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. + */ + +interface CategoryB {} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryC.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryC.java b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryC.java new file mode 100644 index 0000000..3e9e854 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryC.java @@ -0,0 +1,21 @@ +package junit4; +/* + * 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. + */ + +interface CategoryC {} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryCTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryCTest.java b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryCTest.java new file mode 100644 index 0000000..af88bc8 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/CategoryCTest.java @@ -0,0 +1,68 @@ +package junit4; +/* + * 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.AfterClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; + + +@Category(CategoryC.class) +public class CategoryCTest +{ + static int catACount = 0; + static int catBCount = 0; + static int catCCount = 0; + static int catNoneCount = 0; + + @Test + public void testInCategoryA() + { + catACount++; + } + + @Test + @Category(CategoryB.class) + public void testInCategoryB() + { + catBCount++; + } + + @Test + @Category(CategoryC.class) + public void testInCategoryC() + { + catCCount++; + } + + @Test + public void testInNoCategory() + { + catNoneCount++; + } + + @AfterClass + public static void oneTimeTearDown() + { + System.out.println("mA: " + catACount + "\n" + + "mB: " + catBCount + "\n" + + "mC: " + catCCount + "\n" + + "CatNone: " + catNoneCount); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/NoCategoryTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/NoCategoryTest.java b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/NoCategoryTest.java new file mode 100644 index 0000000..f08f40f --- /dev/null +++ b/surefire-its/src/test/resources/junit48-categories/src/test/java/junit4/NoCategoryTest.java @@ -0,0 +1,38 @@ +package junit4; +/* + * 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.AfterClass; +import org.junit.Test; + +public class NoCategoryTest { + static int catNoneCount = 0; + + @Test + public void testInNoCategory() + { + catNoneCount++; + } + + @AfterClass + public static void oneTimeTearDown() + { + System.out.println("NoCategoryTest.CatNone: " + catNoneCount); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-method-pattern/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-method-pattern/pom.xml b/surefire-its/src/test/resources/junit48-method-pattern/pom.xml new file mode 100644 index 0000000..8689549 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-method-pattern/pom.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>junit4</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for JUnit 4.8.1</name> + + <properties> + <junitVersion>4.8.1</junitVersion> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junitVersion}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <test>BasicTest#testSuccess*</test> + <forkMode>once</forkMode> + </configuration> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>surefire-junit47</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>surefire-junit4</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit4</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-method-pattern/src/test/java/junit4/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-method-pattern/src/test/java/junit4/BasicTest.java b/surefire-its/src/test/resources/junit48-method-pattern/src/test/java/junit4/BasicTest.java new file mode 100644 index 0000000..218488c --- /dev/null +++ b/surefire-its/src/test/resources/junit48-method-pattern/src/test/java/junit4/BasicTest.java @@ -0,0 +1,79 @@ +package junit4; + +/* + * 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.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.experimental.categories.Category; + + +public class BasicTest +{ + + private boolean setUpCalled = false; + + private static boolean tearDownCalled = false; + + @Before + public void setUp() + { + setUpCalled = true; + tearDownCalled = false; + System.out.println( "Called setUp" ); + } + + @After + public void tearDown() + { + setUpCalled = false; + tearDownCalled = true; + System.out.println( "Called tearDown" ); + } + + @Test + public void testSetUp() + { + Assert.assertTrue( "setUp was not called", setUpCalled ); + } + + + @Test + public void testSuccessOne() + { + Assert.assertTrue( true ); + } + + @Test + @Category(SampleCategory.class) + public void testSuccessTwo() + { + Assert.assertTrue( true ); + } + + @AfterClass + public static void oneTimeTearDown() + { + + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-method-pattern/src/test/java/junit4/SampleCategory.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-method-pattern/src/test/java/junit4/SampleCategory.java b/surefire-its/src/test/resources/junit48-method-pattern/src/test/java/junit4/SampleCategory.java new file mode 100644 index 0000000..db057af --- /dev/null +++ b/surefire-its/src/test/resources/junit48-method-pattern/src/test/java/junit4/SampleCategory.java @@ -0,0 +1,25 @@ +package junit4; + +/* + * 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 interface SampleCategory +{ + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-multiple-method-patterns/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-multiple-method-patterns/pom.xml b/surefire-its/src/test/resources/junit48-multiple-method-patterns/pom.xml new file mode 100644 index 0000000..f307687 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-multiple-method-patterns/pom.xml @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>jiras-surefire-745-junit</artifactId> + <version>1.0</version> + + <properties> + <included/> + <excluded/> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>junit4-test</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit4</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>junit47-test</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>junit4-includes</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <includes> + <include>${included}</include> + </includes> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit4</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>junit47-includes</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <includes> + <include>${included}</include> + </includes> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>junit4-includes-excludes</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <includes> + <include>${included}</include> + </includes> + <excludes> + <exclude>${excluded}</exclude> + </excludes> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit4</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>junit47-includes-excludes</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <includes> + <include>${included}</include> + </includes> + <excludes> + <exclude>${excluded}</exclude> + </excludes> + </configuration> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/BasicTest.java b/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/BasicTest.java new file mode 100644 index 0000000..44d5978 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/BasicTest.java @@ -0,0 +1,53 @@ +package jiras.surefire745; + + +/* + * 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.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import static org.junit.Assert.*; + + +public class BasicTest +{ + @Rule + public final TestName testName = new TestName(); + + @Test + public void testSuccessOne() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } + + @Test + public void testSuccessTwo() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } + + @Test + public void testFailure() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + fail( ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestFive.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestFive.java b/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestFive.java new file mode 100644 index 0000000..7d88f70 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestFive.java @@ -0,0 +1,49 @@ +package jiras.surefire745; + +/* + * 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.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + + +public class TestFive +{ + @Rule + public final TestName testName = new TestName(); + + @Test + public void testSuccessOne() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } + + @Test + public void testSuccessTwo() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } + + @Test + public void testSuccessThree() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestFour.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestFour.java b/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestFour.java new file mode 100644 index 0000000..824b0d5 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestFour.java @@ -0,0 +1,49 @@ +package jiras.surefire745; + +/* + * 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.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + + +public class TestFour +{ + @Rule + public final TestName testName = new TestName(); + + @Test + public void testSuccessOne() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } + + @Test + public void testSuccessTwo() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } + + @Test + public void testSuccessThree() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestThree.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestThree.java b/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestThree.java new file mode 100644 index 0000000..a868e7c --- /dev/null +++ b/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestThree.java @@ -0,0 +1,51 @@ +package jiras.surefire745; + +/* + * 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.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import static org.junit.Assert.*; + +public class TestThree +{ + @Rule + public final TestName testName = new TestName(); + + @Test + public void testSuccessOne() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } + + @Test + public void testSuccessTwo() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } + + @Test + public void testFailOne() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + fail(); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestTwo.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestTwo.java b/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestTwo.java new file mode 100644 index 0000000..5f1182d --- /dev/null +++ b/surefire-its/src/test/resources/junit48-multiple-method-patterns/src/test/java/jiras/surefire745/TestTwo.java @@ -0,0 +1,42 @@ +package jiras.surefire745; + +/* + * 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.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestTwo +{ + @Rule + public final TestName testName = new TestName(); + + @Test + public void testSuccessOne() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } + + @Test + public void testSuccessTwo() + { + System.out.println( getClass() + "#" + testName.getMethodName() ); + } +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-multiple-methods/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-multiple-methods/pom.xml b/surefire-its/src/test/resources/junit48-multiple-methods/pom.xml new file mode 100644 index 0000000..09ef51e --- /dev/null +++ b/surefire-its/src/test/resources/junit48-multiple-methods/pom.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>junit4</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for JUnit 4.8.1</name> + + <properties> + <junitVersion>4.8.1</junitVersion> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junitVersion}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <test>junit4/BasicTest#testSuccessOne+testFailOne,junit4/TestThree#testSuccessTwo</test> + <forkMode>once</forkMode> + </configuration> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>surefire-junit47</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>surefire-junit4</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit4</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/BasicTest.java b/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/BasicTest.java new file mode 100644 index 0000000..de387d3 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/BasicTest.java @@ -0,0 +1,83 @@ +package junit4; + + +/* + * 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.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + + +public class BasicTest +{ + + private boolean setUpCalled = false; + + private static boolean tearDownCalled = false; + + @Before + public void setUp() + { + setUpCalled = true; + tearDownCalled = false; + System.out.println( "Called setUp" ); + } + + @After + public void tearDown() + { + setUpCalled = false; + tearDownCalled = true; + System.out.println( "Called tearDown" ); + } + + @Test + public void testSetUp() + { + Assert.assertTrue( "setUp was not called", setUpCalled ); + } + + + @Test + public void testSuccessOne() + { + Assert.assertTrue( true ); + } + + @Test + public void testSuccessTwo() + { + Assert.assertTrue( true ); + } + + @Test + public void testFailOne() + { + Assert.assertFalse( false ); + } + + @AfterClass + public static void oneTimeTearDown() + { + + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/TestThree.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/TestThree.java b/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/TestThree.java new file mode 100644 index 0000000..16bc283 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/TestThree.java @@ -0,0 +1,77 @@ +package junit4; + +/* + * 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.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + + +public class TestThree +{ + + private boolean setUpCalled = false; + + private static boolean tearDownCalled = false; + + @Before + public void setUp() + { + setUpCalled = true; + tearDownCalled = false; + System.out.println( "Called setUp" ); + } + + @After + public void tearDown() + { + setUpCalled = false; + tearDownCalled = true; + System.out.println( "Called tearDown" ); + } + + @Test + public void testSetUp() + { + Assert.assertTrue( "setUp was not called", setUpCalled ); + } + + + @Test + public void testSuccessOne() + { + Assert.assertTrue( true ); + } + + @Test + public void testSuccessTwo() + { + Assert.assertTrue( true ); + } + + @AfterClass + public static void oneTimeTearDown() + { + + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/TestTwo.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/TestTwo.java b/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/TestTwo.java new file mode 100644 index 0000000..137bf8b --- /dev/null +++ b/surefire-its/src/test/resources/junit48-multiple-methods/src/test/java/junit4/TestTwo.java @@ -0,0 +1,76 @@ +package junit4; + +/* + * 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.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + + +public class TestTwo +{ + + private boolean setUpCalled = false; + + private static boolean tearDownCalled = false; + + @Before + public void setUp() + { + setUpCalled = true; + tearDownCalled = false; + System.out.println( "Called setUp" ); + } + + @After + public void tearDown() + { + setUpCalled = false; + tearDownCalled = true; + System.out.println( "Called tearDown" ); + } + + @Test + public void testSetUp() + { + Assert.assertTrue( "setUp was not called", setUpCalled ); + } + + + @Test + public void testSuccessOne() + { + Assert.assertTrue( true ); + } + + @Test + public void testSuccessTwo() + { + Assert.assertTrue( true ); + } + + @AfterClass + public static void oneTimeTearDown() + { + + } + +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-single-method/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-single-method/pom.xml b/surefire-its/src/test/resources/junit48-single-method/pom.xml new file mode 100644 index 0000000..96061ce --- /dev/null +++ b/surefire-its/src/test/resources/junit48-single-method/pom.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>it-parent</artifactId> + <version>1.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <groupId>org.apache.maven.plugins.surefire</groupId> + <artifactId>junit4</artifactId> + <version>1.0-SNAPSHOT</version> + <name>Test for JUnit 4.8.1</name> + + <properties> + <junitVersion>4.8.1</junitVersion> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>${junitVersion}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <test>BasicTest#testSuccessOne</test> + <forkMode>once</forkMode> + </configuration> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>surefire-junit47</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>surefire-junit4</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit4</artifactId> + <version>${surefire.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/09f0eef8/surefire-its/src/test/resources/junit48-single-method/src/test/java/junit4/BasicTest.java ---------------------------------------------------------------------- diff --git a/surefire-its/src/test/resources/junit48-single-method/src/test/java/junit4/BasicTest.java b/surefire-its/src/test/resources/junit48-single-method/src/test/java/junit4/BasicTest.java new file mode 100644 index 0000000..d983259 --- /dev/null +++ b/surefire-its/src/test/resources/junit48-single-method/src/test/java/junit4/BasicTest.java @@ -0,0 +1,71 @@ +package junit4; + + +/* + * 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.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + + +public class BasicTest +{ + + private boolean setUpCalled = false; + + private static boolean tearDownCalled = false; + + @Before + public void setUp() + { + setUpCalled = true; + tearDownCalled = false; + System.out.println( "Called setUp" ); + } + + @After + public void tearDown() + { + setUpCalled = false; + tearDownCalled = true; + System.out.println( "Called tearDown" ); + } + + @Test + public void testSetUp() + { + Assert.assertTrue( "setUp was not called", setUpCalled ); + } + + + @Test + public void testSuccessOne() + { + Assert.assertTrue( true ); + } + + @AfterClass + public static void oneTimeTearDown() + { + + } + +}