9

Is there a spock equivalent of TestNG's @Test(threadPoolSize=n) that will allow me test the execution of a test, with multiple threads concurrently?

Basically, given a specification like so...

class SampleSpec extends Specification {
    def "test concurrent access"(){
        setup:
        //do complex logic
        expect:
        //assert complex logic
    }

}

What I want is a way to do this in spock, but with multiple threads spawned concurrently to execute the test method. In TestNG, I could easily achieve this by doing

@Test(threadPoolSize=10)
public void testMethod(){
    //do complex logic and assertion

}

Thanks in advance.

lospejos
  • 1,976
  • 3
  • 19
  • 35
GroovyBee
  • 275
  • 3
  • 10
  • I don't believe there is, but this will probably get a quicker answer in [their discussion forum](http://groups.google.com/group/spockframework?pli=1) – tim_yates Nov 01 '11 at 11:19
  • thanks tim. I have posted to the spock forum as you have suggested – GroovyBee Nov 01 '11 at 14:01

1 Answers1

1

Spock doesn't support this out of the box. It wouldn't be so hard to write a Spock extension for it though. For inspiration, have a look at class org.spockframework.runtime.extension.builtin.TimeoutExtension.

Peter Niederwieser
  • 121,412
  • 21
  • 324
  • 259