在Maven构建中并行运行junit测试? [英] Running junit tests in parallel in a Maven build?

查看:656
本文介绍了在Maven构建中并行运行junit测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JUnit 4.4和Maven,并且我有大量长时间运行的集成测试。

I'm using JUnit 4.4 and Maven and I have a large number of long-running integration tests.

在并行化测试套件时,有一些允许我在一个测试类中并行运行每个测试方法的解决方案。但所有这些都要求我以这种或那种方式改变测试。

When it comes to parallelizing test suites there are a few solutions that allow me to run each test method in a single test-class in parallel. But all of these require that I change the tests in one way or another.

我真的认为在X线程中运行X个不同的测试类是一个更清晰的解决方案在平行下。我有数百个测试,所以我并不真正关心线程化个别测试类。

I really think it would be a much cleaner solution to run X different test classes in X threads in parallel. I have hundreds of tests so I don't really care about threading individual test-classes.

有没有办法做到这一点?

Is there any way to do this?

推荐答案

从junit 4.7开始,现在可以在不使用TestNG的情况下并行运行测试。实际上从4.6开始就有可能,但是在4.7中有一些修正,这将使它成为一个可行的选择。您也可以使用spring运行并行测试,您可以阅读这里

From junit 4.7 it's now possible to run tests in parallel without using TestNG. Actually it has been possible since 4.6, but there are a number of fixes being made in 4.7 that will make it a viable option. You may also run parallel tests with spring, which you can read about here

这篇关于在Maven构建中并行运行junit测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆