问题描述
给定以下 junit5 测试类,我如何并行运行 upperCaseTest
和 lowerCaseTest
,同时每个测试方法中的参数化运行按顺序运行。换句话说,“A”、“B”和“C”应该依次运行,“x”、“y”、“z”应该依次运行,但“A”和“x”应该能够并行运行.
@Execution(ExecutionMode.CONCURRENT)
class ParallelParameterizedTest {
@ParameterizedTest
@ValueSource(strings = {"A","B","C"})
void upperCaseTest(String s) {
assertEquals(s.toupperCase(),s);
}
@Parameterizedtest()
@ValueSource(strings = {"x","y","z"})
void lowerCaseTest(String s) {
assertEquals(s.toLowerCase(),s);
}
}
我的junit-platform.properties文件如下:
junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.config.strategy = fixed
junit.jupiter.execution.parallel.config.fixed.parallelism = 2
实际行为是所有测试并行运行。
junit5 的 Gitter 页面 (https://gitter.im/junit-team/junit5?at=6005fe8fac653a0802c8c258) 上有一个正在进行的线程
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)