Last active
December 14, 2015 04:39
-
-
Save dmakhno/5029402 to your computer and use it in GitHub Desktop.
dynamic parallel ScalaTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SequentialTest(alias:String) extends FreeSpec with CancelAfterFailure { | |
"for %s".format(alias) - { | |
"Phase 1" in { | |
for (j <- 0 until 10) { | |
println("%s: working %s Phase-1 %s".format(new DateTime(),alias,j)) | |
Thread.sleep(100) | |
} | |
} | |
"Phase 2" in { | |
for (j <- 0 until 10) { | |
println("%s: working %s Phase-2 %s".format(new DateTime(),alias,j)) | |
Thread.sleep(100) | |
} | |
} | |
} | |
} | |
class parallel1Test extends SequentialTest(" Config1") | |
class parallel2Test extends SequentialTest(" Config2") | |
class parallel3Test extends SequentialTest(" Config3") | |
class parallel4Test extends SequentialTest(" Config4") | |
class parallel5Test extends SequentialTest(" Config5") | |
class parallel6Test extends SequentialTest(" Config6") | |
class parallel7Test extends SequentialTest(" Config7") | |
class parallel8Test extends SequentialTest(" Config8") | |
class parallel9Test extends SequentialTest(" Config9") | |
class parallel10Test extends SequentialTest("Config10") | |
class parallel11Test extends SequentialTest("Config11") | |
class parallel12Test extends SequentialTest("Config12") | |
class parallel13Test extends SequentialTest("Config13") | |
class parallel14Test extends SequentialTest("Config14") | |
class parallel15Test extends SequentialTest("Config15") | |
class parallel16Test extends SequentialTest("Config16") | |
class parallel17Test extends SequentialTest("Config17") | |
class parallel18Test extends SequentialTest("Config18") | |
class parallel19Test extends SequentialTest("Config19") | |
class parallel20Test extends SequentialTest("Config20") | |
class dynamicParallelTests extends FreeSpec with ParallelTestExecution with Logging{ | |
override val nestedSuites = Vector(" Config1", " Config2", " Config3", " Config4", | |
" Config5", " Config6", " Config7", " Config8", | |
" Config9", "Config10", "Config11", "Config12", | |
"Config13", "Config14", "Config15", "Config16", | |
"Config17", "Config18", "Config19", "Config20").map(new SequentialTest(_)) | |
} | |
class dynamicParallelTests2 extends Suites( | |
(for (alias <- Vector(" Config1", " Config2", " Config3", " Config4", | |
" Config5", " Config6", " Config7", " Config8", | |
" Config9", "Config10", "Config11", "Config12", | |
"Config13", "Config14", "Config15", "Config16", | |
"Config17", "Config18", "Config19", "Config20")) | |
yield new SequentialTest(alias)): _* | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment