forked from apache/maven-surefire
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SUREFIRE-1055] Incorrect reported test result for parallel run mode
Test case supplied by Chris Hansen Fixed Fix
- Loading branch information
1 parent
9e0102a
commit 9ef1843
Showing
10 changed files
with
397 additions
and
1 deletion.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...st/java/org/apache/maven/surefire/its/jiras/Surefire1055CorrectConcurrentTestCountIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.apache.maven.surefire.its.jiras; | ||
|
||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import org.apache.maven.surefire.its.fixture.OutputValidator; | ||
import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; | ||
import org.junit.Test; | ||
|
||
/** | ||
* SUREFIRE-1055 Correct test count in parallel run mode. | ||
* | ||
* @author Kristian Rosenvold | ||
*/ | ||
public class Surefire1055CorrectConcurrentTestCountIT | ||
extends SurefireJUnit4IntegrationTestCase | ||
{ | ||
@Test | ||
public void testTestNgAndJUnitTogether() | ||
{ | ||
OutputValidator outputValidator = unpack( "surefire-1055-parallelTestCount" ).executeTest(); | ||
outputValidator.assertTestSuiteResults( 21, 0, 0, 0 ); | ||
|
||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
surefire-integration-tests/src/test/resources/surefire-1055-parallelTestCount/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!-- | ||
~ 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>foo</groupId> | ||
<artifactId>foo</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>foo</name> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.11</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.1</version> | ||
<configuration> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${surefire.version}</version> | ||
<configuration> | ||
<parallel>classesAndMethods</parallel> | ||
<perCoreThreadCount>false</perCoreThreadCount> | ||
<useUnlimitedThreads>true</useUnlimitedThreads> | ||
<threadCountMethods>3</threadCountMethods> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
30 changes: 30 additions & 0 deletions
30
...sts/src/test/resources/surefire-1055-parallelTestCount/src/test/java/foo/Method1Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* 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 foo; | ||
|
||
import org.junit.Test; | ||
|
||
public class Method1Test | ||
{ | ||
@Test | ||
public void only() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...ts/src/test/resources/surefire-1055-parallelTestCount/src/test/java/foo/Methods2Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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 foo; | ||
|
||
import org.junit.Test; | ||
|
||
public class Methods2Test | ||
{ | ||
@Test | ||
public void first() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void second() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...ts/src/test/resources/surefire-1055-parallelTestCount/src/test/java/foo/Methods3Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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 foo; | ||
|
||
import org.junit.Test; | ||
|
||
public class Methods3Test | ||
{ | ||
@Test | ||
public void first() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void second() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void third() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
...ts/src/test/resources/surefire-1055-parallelTestCount/src/test/java/foo/Methods4Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* 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 foo; | ||
|
||
import org.junit.Test; | ||
|
||
public class Methods4Test | ||
{ | ||
@Test | ||
public void first() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void second() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void third() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void fourth() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...ts/src/test/resources/surefire-1055-parallelTestCount/src/test/java/foo/Methods5Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* 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 foo; | ||
|
||
import org.junit.Test; | ||
|
||
public class Methods5Test | ||
{ | ||
@Test | ||
public void first() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void second() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void third() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void fourth() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void fifth() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...ts/src/test/resources/surefire-1055-parallelTestCount/src/test/java/foo/Methods6Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package foo; | ||
|
||
import org.junit.Test; | ||
|
||
public class Methods6Test | ||
{ | ||
@Test | ||
public void first() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void second() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void third() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void fourth() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void fifth() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
|
||
@Test | ||
public void sixth() | ||
{ | ||
SleepUtil.sleep(); | ||
} | ||
} |
Oops, something went wrong.