maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paolo Castagna <castagna.li...@googlemail.com>
Subject Re: Wrong number of tests run when running JUnit tests in parallel: any help?
Date Mon, 12 Apr 2010 12:49:34 GMT
Kristian Rosenvold wrote:
> As the blogpost mentions, junit+surefire by itself is unable to 
> constrain the number of threads; you need CPC=true for any kind of 
> thread limitation.
> 
> Both threadCount and perCoreThreadCount are thread constraints, so you 
> need CPC for both of them.

Let's say I have a Quad Core and I want to run 1 thread per core.

Do I need to use: <threadCount>4</threadCount>?
Or: <perCoreThreadCount>1</perCoreThreadCount>?
Or, they are both equivalent on a Quad Core?

What happens if I use both the options and they have conflicting values?

   <threadCount>100</threadCount>
   <perCoreThreadCount>2</perCoreThreadCount>

Will this setting be running 100 threads in parallel or 8 on a Quad Core
system?

I re-read the blogpost, but I did not find an answer there.

> And btw; if you like running betas you'll get a significant speed boost 
> by switching to jdk 7 ;)

Thanks for the suggestion and for your patience.

Paolo

> Kristian
> 
> 
> Den 12.04.2010 14:05, skrev Paolo Castagna:
>> Kristian Rosenvold wrote:
>>> All your questions should be answered here; 
>>> http://incodewetrustinc.blogspot.com/2010/01/run-your-junit-tests-concurrently-with.html

>>
>>
>>
>> Thanks for the link, very useful.
>>
>> I have installed the configurable-parallel-computer as well.
>> Now I see configurableParallelComputerPresent=true. :-)
>>
>> But, I am still confused by the threadCount option...
>> Does it have any effect without the configurable-parallel-computer?
>> Does it have any effect if used in conjunction with perCoreThreadCount?
>>
>>> I generally do not advise the use of "both", "classes" is both easier 
>>> to get running and usually faster.
>>
>> I am now using "classes", I trust you.
>>
>> For the project I am currently testing the "parallel" execution of
>> tests, I am probably in this scenario, as you wrote: "For a fairly
>> optimized unit-test set, expect little or no gain - maybe 15-20%."
>>
>> But, I'll use the approach for other projects.
>>
>> Paolo
>>
>>>
>>>
>>> Kristian
>>>
>>>
>>>
>>>
>>>
>>> Den 12.04.2010 12:58, skrev Paolo Castagna:
>>>> Thank you Kristian,
>>>> my mistake. I was trying to use parallel with an old project which
>>>> uses JUnit3 tests via JUnit4, so no @Test annotations.
>>>>
>>>> Now, I am trying again with another project which is using JUnit4
>>>> with tests annotated with @Test.
>>>>
>>>> But I do not see any speed-up improvement (on a Quad Core).
>>>>
>>>> Also, I see:
>>>>
>>>> [INFO] Concurrency config is {threadCount=4, parallel=both, 
>>>> configurableParallelComputerPresent=false}
>>>>
>>>> What the "configurableParallelComputerPresent=false" means?
>>>>
>>>> I am not even sure if threadCount=4 means 4 threads per core
>>>> or 4 threads in total.
>>>>
>>>> But, at least, this time the number of tests executed is correct.
>>>>
>>>> Thanks again,
>>>> Paolo
>>>>
>>>> Kristian Rosenvold wrote:
>>>>> Please note that the parallel provider actually requires correctly 
>>>>> defined junit4/junit3 tests to run, annotate your methods with @Test.
>>>>>
>>>>> The "classic" Junit 4 provider would run a large number of tests 
>>>>> that were incorrectly defined according to junit specifications. 
>>>>> The concurrent provider uses the same
>>>>> selection mechanism as the junit 4 provider, but junit itself adds 
>>>>> an additional compliance check before running the test.
>>>>>
>>>>> I also recommend you use the latest release of Junit; 4.8.2, or 
>>>>> 4.8.1 if 4.8.2 hasn't reached the repos yet.
>>>>>
>>>>> Kristian
>>>>> Den 11.04.2010 23:58, skrev Paolo Castagna:
>>>>>> Hi,
>>>>>> I am trying to see if running JUnit tests in parallel makes any
>>>>>> difference and/or significant speed-up.
>>>>>>
>>>>>> I have this in my pom.xml:
>>>>>>
>>>>>> <dependency>
>>>>>> <groupId>junit</groupId>
>>>>>> <artifactId>junit</artifactId>
>>>>>> <version>4.7</version>
>>>>>> <scope>test</scope>
>>>>>> </dependency>
>>>>>>
>>>>>> [...]
>>>>>>
>>>>>> <plugin>
>>>>>> <groupId>org.apache.maven.plugins</groupId>
>>>>>> <artifactId>maven-surefire-plugin</artifactId>
>>>>>> <version>2.5</version>
>>>>>> <configuration>
>>>>>> <includes>
>>>>>> <include>[...]</include>
>>>>>> </includes>
>>>>>> <parallel>methods</parallel>
>>>>>> <threadCount>4</threadCount>
>>>>>> </configuration>
>>>>>> </plugin>
>>>>>>
>>>>>> When I run the tests without <parallel> and <threadCount>
I see:
>>>>>>
>>>>>> Tests run: 9491, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:

>>>>>> ...
>>>>>>
>>>>>> While when I run the tests with <parallel> and <threadCount>
as 
>>>>>> showed
>>>>>> above:
>>>>>>
>>>>>> Tests run: 40, Failures: 0, Errors: 0, Skipped: 0
>>>>>>
>>>>>> Is this a bug?
>>>>>>
>>>>>> Am I doing something wrong here?
>>>>>>
>>>>>> Thanks,
>>>>>> Paolo
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message