Reputation: 9159
A Spock specification looks like:
def mySpec(someData) {
//testStuff
where: someData << someDataList
}
someDataList
is a list of records that is tested and for each member of this list, the mySpec
method is run, sequentially. What I want is that the first k members of the list to run a thread, the following k members to run in a second thread and so on... In theory this can be done relatively easy with Executors Framework and JUnitCore
class (since Spock relies on JUnit).
The problem however is how to inject smaller someDataList
into the class that has mySpec
method, because Spock doesn't allow a constructor and JUnitCore wants class name (the class that has the test/specification) and not an instance. An ugly solution would be to make n copies of mySpec
, each having a distinct smaller someDataList
, and each to be run by a distinct thread; but this is a very ugly solution.
Is there a workaround for this? Or is there another way of running Spock specifications/tests in parallel?
Upvotes: 2
Views: 4203
Reputation: 123910
You can run specs in parallel if your environment (build tool, IDE) supports it. Running features or iterations in parallel isn't currently possible.
Upvotes: 3