Skip to content

Commit

Permalink
[SUREFIRE-1055] Incorrect reported test result for parallel run mode
Browse files Browse the repository at this point in the history
Test case supplied by Chris Hansen

Fixed

Fix
  • Loading branch information
krosenvold committed Feb 13, 2014
1 parent 9e0102a commit 9ef1843
Show file tree
Hide file tree
Showing 10 changed files with 397 additions and 1 deletion.
@@ -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 );

}
}
@@ -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>
@@ -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();
}
}
@@ -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();
}
}
@@ -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();
}

}
@@ -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();
}
}
@@ -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();
}
}
@@ -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();
}
}

0 comments on commit 9ef1843

Please sign in to comment.