从Junit4.7开始能够并行运行测试。html
必须设置parallel 参数,能够改变threadCount或useUnlimitedThreads属性。apache
测试中指定了parallel,项目使用的是 JUnit 4.7+的话,就会用到concurrent JUnit provider,它利用了JUnit JUnitCore test runner。并发
(对于能够有高并发的测试颇有用)eclipse
Surefire 2.7以前,不须要额外的依赖。maven
Surefire 2.16以前,引入了threadCountSuites, threadCountClasses 和threadCountMethods。另外,parallelTestsTimeoutInSeconds 和parallelTestsTimeoutForcedInSeconds用来在超时后关闭并行执行。ide
☆ 方法级别的并行,测试类级别的并行高并发
Links:测试
1. Running Tests in Parallel - mavenui
2. Run JUnit4-Tests parallel in Eclipsehtm