[ 
https://jira.codehaus.org/browse/SUREFIRE-869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=301375#comment-301375
 ] 

Guillermo GARCIA OCHOA commented on SUREFIRE-869:
-------------------------------------------------

I'm getting exactly the same issue with this configuration:
{code}
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.12</version>
    <configuration>
      <forkMode>perthread</forkMode>
      <threadCount>2</threadCount>
    </configuration>
</plugin>
{code}
                
> Parallel test execution on class level runs not all tests but some twice
> ------------------------------------------------------------------------
>
>                 Key: SUREFIRE-869
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-869
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Junit 4.7+ (parallel) support
>    Affects Versions: 2.12
>         Environment: Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)
> Maven home: /opt/local/share/java/maven3
> Java version: 1.7.0_04, vendor: Oracle Corporation
> Java home: /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x", version: "10.7.4", arch: "x86_64", family: "mac"
> JUnit 4.10
>            Reporter: Martin Burger
>            Priority: Blocker
>         Attachments: parallel-tests.tgz
>
>
> When I run JUnit tests in parallel on the class level, Surefire behaves 
> somehow erratically. For instance, having test classes TestA and TestB, 
> Surefire sometimes runs TestA twice, TestB twice at other times - but never 
> TestA and TestB in parallel.
> I attached a simple Maven project that helps reproduce this issue. Via {{mvn 
> test -P sequential}} you can execute two test classes sequentially:
> {noformat}
> ...
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running mavendebug.TestAppFirstTest
> -----------------> TestAppFirstTest.test()
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.036 sec
> Running mavendebug.TestAppSecondTest
> -----------------> TestAppSecondTest.test()
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
> Results :
> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
> ...
> {noformat}
> Running {{mvn test}} instead runs tests in parallel:
> {noformat}
> ...
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Concurrency config is parallel='classes', perCoreThreadCount=false, 
> threadCount=4, useUnlimitedThreads=false
> Concurrency config is parallel='classes', perCoreThreadCount=false, 
> threadCount=4, useUnlimitedThreads=false
> Running mavendebug.TestAppSecondTest
> Running mavendebug.TestAppSecondTest
> -----------------> TestAppSecondTest.test()
> -----------------> TestAppSecondTest.test()
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
> Results :
> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
> ...
> {noformat}
> As you can see, TestAppSecondTest is executed twice, while test 
> TestAppFirstTest is not executed at all.
> Please note: I chose Blocker as priority as this caused (1) that our 
> extensive test suite was not executed completely during the last weeks which 
> we only discovered today, and (2) that caused tests that run against a 
> database to fail with unexpected constraint violations just because those 
> tests where executed twice in parallel.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to