jtanistra / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

Run tests in parallel #34

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have an enhancement request to make tests run in parallel. I like Spock
so much, I'm using it to run some validation tests that run over a large
dataset. I use the data provider way and @Unroll to run the tests as unique
tests. They work great, except they run serially and I'd like to use up all
the cores that the machine has (> 4).

Original issue reported on code.google.com by senthilv...@gmail.com on 17 Jul 2009 at 9:42

GoogleCodeExporter commented 8 years ago
Parallel test execution is definitely on our list. Is it important for you to 
run a single method in parallel, our 
would the ability to run different methods or classes in parallel be equally 
effective for you?

Original comment by pnied...@gmail.com on 18 Jul 2009 at 12:53

GoogleCodeExporter commented 8 years ago
In the specific case I mentioned, having the ability for the single method to 
run in
parallel is more effective since it is called multiple times (many hundreds) 
using
@Unroll.

Thanks for a great product!
-Senthil.

Original comment by senthilv...@gmail.com on 20 Jul 2009 at 6:31

GoogleCodeExporter commented 8 years ago
Thanks for your feedback! 

Original comment by pnied...@gmail.com on 25 Jul 2009 at 1:49

GoogleCodeExporter commented 8 years ago

Original comment by pnied...@gmail.com on 28 Oct 2009 at 12:50

GoogleCodeExporter commented 8 years ago

Original comment by pnied...@gmail.com on 19 Jul 2010 at 10:17

GoogleCodeExporter commented 8 years ago

Original comment by pnied...@gmail.com on 25 Nov 2010 at 5:31

GoogleCodeExporter commented 8 years ago
Any updates regarding this issue?

Original comment by behra...@dius.com.au on 4 Mar 2013 at 2:27

GoogleCodeExporter commented 8 years ago
I got it managed to run the tests in parallel with JUnit and Maven, but it is 
not a nice solution. It would be nice if Spock offers something or TestNG 
instead of JUnit can be used (parallelization works like charm there)

Original comment by Sven.Ruc...@gmail.com on 9 Apr 2013 at 12:53

GoogleCodeExporter commented 8 years ago
Can you elaborate on "it is not a nice solution"?

Original comment by pnied...@gmail.com on 9 Apr 2013 at 1:29

GoogleCodeExporter commented 8 years ago
I used maven for doing this, but the are problems with the correct 
dependencies. Following worked for me:

Spock: 0.7-groovy-2.0
JUnit 4.11
Selenium 2.31 (Tried to do parallel testing with it)

Problem is here the surefire plugin from maven:
2.11 it works with
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.11</version>
                <dependencies>
                    <!--SPOCK This is to force to use JUnit 4.7+ Runner -->
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>2.11</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <includes>
                        <!--SPOCK  -->
                        <include>**/*Spec.java</include>
                    </includes>
                    <!-- Surefire 2.13 and below configuration for parallelization-->
                    <parallel>classes</parallel>
                    <threadCount>3</threadCount>
                    <perCoreThreadCount>true</perCoreThreadCount>
                    <useUnlimitedThreads>false</useUnlimitedThreads>
                </configuration>
            </plugin>

Everything beyond 2.11 of surefire doesn`t work. I always get exceptions. 
For Surefire 2.14 config for parallelization has changed to:
<configuration>
          <forkCount>5</forkCount>
          <reuseForks>false</reuseForks>
</configuration>

Original comment by Sven.Ruc...@gmail.com on 11 Apr 2013 at 5:38

GoogleCodeExporter commented 8 years ago
What exact exception(s) do you get?

Original comment by pnied...@gmail.com on 11 Apr 2013 at 5:40

GoogleCodeExporter commented 8 years ago
More info here on stack-overflow 
http://stackoverflow.com/questions/15526510/junit-maven-parallel-test-execution-
error

Original comment by Sven.Ruc...@gmail.com on 11 Apr 2013 at 3:58

GoogleCodeExporter commented 8 years ago
Any update on this? We're using gradle, and adding in the maxParallelForks 
option doesn't seem to solve this issue in the same way that it seemed to for 
the maven user above.

Original comment by sgent...@gmail.com on 29 May 2013 at 8:55

GoogleCodeExporter commented 8 years ago
It seems our issue was due to having overridden the default test task. Once we 
removed that, things worked as expected.

Original comment by sgent...@gmail.com on 30 May 2013 at 2:04

GoogleCodeExporter commented 8 years ago
One thing that's not possible currently is to have multiple iterations of a 
data-driven feature run on multiple threads.
I have a Spec with a single feature that is run with about 200 different 
configurations. The feature has an @Unroll annotation, but I don't think that 
it makes a difference.

Original comment by foober...@gmail.com on 27 Nov 2014 at 2:47