[SUREFIRE-1209] added surefire-junit4 support
Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/fd3ed68a Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/fd3ed68a Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/fd3ed68a Branch: refs/heads/master Commit: fd3ed68a155d83e96c0d63764a24da1bb46c95a9 Parents: d891907 Author: Tibor17 <tibo...@lycos.com> Authored: Sat Dec 19 22:21:04 2015 +0100 Committer: Tibor17 <tibo...@lycos.com> Committed: Sat Dec 26 02:22:48 2015 +0100 ---------------------------------------------------------------------- .../jiras/Surefire1209RerunAndForkCountIT.java | 2 +- .../surefire-1209-rerun-and-forkcount/pom.xml | 71 +++++++++++++++----- 2 files changed, 56 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fd3ed68a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1209RerunAndForkCountIT.java ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1209RerunAndForkCountIT.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1209RerunAndForkCountIT.java index 90108d1..a6cb73d 100644 --- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1209RerunAndForkCountIT.java +++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1209RerunAndForkCountIT.java @@ -1 +1 @@ -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 {@linkplain https://jira.codehaus.org/browse/SUREFIRE-1209} * @since 2.19 */ public class Surefire1209RerunAndForkCountIT extends SurefireJUnit4IntegrationTestCase { @Test public void reusableForks() throws VerificationException { unpack().executeTest() .assertTestSuiteResults( 5, 0, 0, 0, 4 ); } @Test public void notReusableForks() throws VerificationException { unpack().reuseForks( false ) .executeTest() .assertTestSuiteResults( 5, 0, 0, 0, 4 ); } private SurefireLauncher unpack() { return unpack( "surefire-1209-rerun-and-forkcount" ); } } \ No newline at end of file +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 {@linkplain https://jira.codehaus.org/browse/SUREFIRE-1209} * @since 2.19 */ public class Surefire1209RerunAndForkCountIT extends SurefireJUnit4IntegrationTestCase { @Test public void reusableForksJUnit47() throws VerificationException { unpack().executeTest() .assertTestSuiteResults( 5, 0, 0, 0, 4 ); } @Test public void notReusableForksJUnit47() throws VerificationException { unpack().reuseForks( false ) .executeTest() .assertTestSuiteResults( 5, 0, 0, 0, 4 ); } @Test public void reusableForksJUnit4() throws VerificationException { unpack().addGoal( "-Pjunit4" ) .executeTest() .assertTestSuiteResults( 5, 0, 0, 0, 4 ); } @Test public void notReusableForksJUnit4() throws VerificationException { unpack().addGoal( "-Pjunit4" ) .reuseForks( false ) .executeTest() .assertTestSuiteResults( 5, 0, 0, 0, 4 ); } private SurefireLauncher unpack() { return unpack( "surefire-1209-rerun-and-forkcount" ); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/fd3ed68a/surefire-integration-tests/src/test/resources/surefire-1209-rerun-and-forkcount/pom.xml ---------------------------------------------------------------------- diff --git a/surefire-integration-tests/src/test/resources/surefire-1209-rerun-and-forkcount/pom.xml b/surefire-integration-tests/src/test/resources/surefire-1209-rerun-and-forkcount/pom.xml index 2e10ed5..15fe206 100644 --- a/surefire-integration-tests/src/test/resources/surefire-1209-rerun-and-forkcount/pom.xml +++ b/surefire-integration-tests/src/test/resources/surefire-1209-rerun-and-forkcount/pom.xml @@ -59,23 +59,62 @@ <target>1.5</target> </configuration> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>${surefire.version}</version> - <configuration> - <forkCount>2</forkCount> - <rerunFailingTestsCount>3</rerunFailingTestsCount> - </configuration> - <dependencies> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-junit47</artifactId> - <version>${surefire.version}</version> - </dependency> - </dependencies> - </plugin> </plugins> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${surefire.version}</version> + <configuration> + <forkCount>2</forkCount> + <rerunFailingTestsCount>3</rerunFailingTestsCount> + </configuration> + </plugin> + </plugins> + </pluginManagement> </build> + <profiles> + <profile> + <id>junit47</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <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</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> \ No newline at end of file