Repository navigation
Replies: 1 comment
|
Hi @javanerd Today this maps much more naturally to a parameterized class than to a single parameterized test method.
For current JUnit, for example: @ParameterizedClass
@ValueSource(strings = {"12345", "67890"})
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@Execution(ExecutionMode.CONCURRENT)
class TrickyTestExecutionOrder {
@Parameter
String number;
@Test
@Order(1)
@Execution(ExecutionMode.SAME_THREAD)
void firstParallelForEachNumber() {
// use number
}
@Test
@Order(2)
@Execution(ExecutionMode.SAME_THREAD)
void thenDoThis() {
// use number
}
@Test
@Order(3)
@Execution(ExecutionMode.SAME_THREAD)
void andDoThat() {
// use number
}
@Test
@Order(4)
@Execution(ExecutionMode.SAME_THREAD)
void andFinallyThisAgain() {
// use number
}
}Enable Jupiter parallel execution, for example in junit.jupiter.execution.parallel.enabled=trueIf you specifically want at least two workers: junit.jupiter.execution.parallel.config.strategy=fixed
junit.jupiter.execution.parallel.config.fixed.parallelism=2
Because this example uses One important limitation: If This capability was not available when the original question was asked in 2022, which is why older solutions are substantially more complicated. Please mark this answer as accepted if it helped, thank you. |
Uh oh!
There was an error while loading. Please reload this page.
Hi guys, i just started a request on stackoverflow:
Request on stackoverflow
Perhaps someone here has time to look at it. Thank you in advance.
All reactions