JUnit5实现并发执行用例
1.添加或修改配置文件junit-platform.properties,该文件在resources目录下,并将resource标记为Test Resources Root
以下需添加进文件中的内容,值根据自身情况修改
#是否允许并行执行true/false
junit.jupiter.execution.parallel.enabled=true
#是否支持方法级别多线程 same_thread/concurrent
junit.jupiter.execution.parallel.mode.default = concurrent
#是否支持类级别多线程 same_thread/concurrent
junit.jupiter.execution.parallel.mode.classes.default = concurrent
#the maximum pool size can bu configured using a ParalleExecutionConfigurationStrategy
junit.jupiter.execution.parallel.config.strategy = fixed
junit.jupiter.execution.parallel.config.fixed.parallelism = 5
2.用例前添加
@RepeatedTest(10) //10为当前用例执行的次数
@Execution(CONCURRENT) //CONCURRENT表示支持多线程
相关推荐
shirleypaddy 2020-10-19
qingmumu 2020-10-19
lustdevil 2020-10-18
ganlulululu 2020-10-12
lustdevil 2020-08-03
lustdevil 2020-07-18
lustdevil 2020-06-25
lustdevil 2020-06-21
zhengzf0 2020-06-21
宿命java 2020-06-15
JackYin 2020-06-14
dongxurr 2020-06-07
snowphy 2020-06-06
zhengzf0 2020-05-28
81901836 2020-05-26
Julywhj 2020-05-26
SolitudeSky 2020-05-18