Hi Daniel,
ParallelTestExecution will run each test in its own instance to make it less likely that different threads to access shared mutable state (in instance vars or vals holding references to mutable object), which means people don't need to think as much about synchronizing access to that state (which often I figure they wouldn't think about anyway in the heat of battle).
I'd suggest instead of making tests dynamically you make nested suites dynamically, and put one test in each instance. You don't need to use ParallelTestExecution because Suites run in parallel by default so long as parallel is enabled (which it is by default in sbt in case you're using sbt). You might try something like:
import org.salatest.Suites
class MyParallelTestSuite extends Suites(
for {
a <- as,
b <- bs,
c <- cs
} yield {
new FunSuite {
test(makeSomeName(a, b, c)) {
// ...do something...
}
}
}: _*
)
Except I just realized you'll probably hit the JVM's limit on how many parameters you can pass to a constructor. You can instead either make a tree, such as one nested suite for each A that has one nested suite for each B, which has one nested suite for each C. Or just extend FunSuite and override nestedSuites, something like this:
class MyParallelTestSuite extends FunSuite {
override def nestedSuites: IndexedSeq[Suite] =
for {
a <- as,
b <- bs,
c <- cs
} yield {
new FunSuite {
test(makeSomeName(a, b, c)) {
// ...do something...
}
}
}
}
Bill