用于分发单元测试执行的 Maven 插件
我花了相当多的时间查看当前的构建过程,试图将整个增量构建恢复到 10 分钟(当前为 1 小时)。我们构建中最大的时间消耗似乎是大量的单元测试,由于某种原因,这些单元测试需要相当多的时间来执行。
最近,我尝试将单元测试的执行分布在少量刀片上。这将 junit 测试的整体执行时间增加到一个非常可容忍的范围内,但需要在 CI 盒上进行大量手动脚本编写和管理才能保持测试正常运行。理想情况下,我想在主节点上编译源代码,使用分布式 Surefire 之类的插件联合运行单元测试,然后使用主节点打包结果。目前我没有看到使用分布式编译器有任何显着的好处。
其他人是否将单元测试执行分布在多个盒子上?是否有任何插件(商业或开源)可以使此过程更易于管理?任何有关其他人如何解决(或不解决)这个问题的见解将不胜感激。
I've spent quite a bit of time looking at our current build process in an attempt to bring the whole incremental build back into the 10 minute mark (currently 1 hour). The largest consumption of time on our build seems to be the large number of unit tests that, for one reason or another, take quite a bit of time to execute.
Recently, I've experimented with distributing the execution of the unit tests on a small number of blades. This increased the overall execution time of the junit tests into a very tolerable range but required a lot of manual scripting and administration on the CI box to keep the tests working. Ideally, I'd like to compile the source on a master node, use a distributed surefire like plugin to jointly run the unit tests and then use the master node to package the results. I don't see any significant gains to using a distributed compiler at this time.
Are other people distributing the unit test execution across a number of boxes? Are there any plugins (commercial or open source) that would make this process easier to manage? Any insight to how others are tackling (or not tackling) this problem would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以考虑 STAF
或
使用 testng 与 hudson 以及 hudson 的 Slave 功能一起分配作业。
you may consider STAF
or
using testng together with hudson and hudson's slave feature to distribute jobs.
可以使用 Surefire 插件并覆盖默认的 JVM 参数。通过这种方式,可以使用自定义脚本来代替,该脚本又会派生一个新的 docker 容器,该容器将从容器内运行 JVM。容器必须能够访问主机文件系统才能访问编译类和其他资源。我创建了一个小型概念验证项目来说明使用 SSHFS 的解决方案。
https://github.com/Jotschi/docker-junit-distribution-test
It is possible to use the surefire plugin and overwrite the default JVM parameter. This way a custom script can be used instead which in turn will fork a new docker container that will run the JVM from within the container. The container must be able to access the host file system in order to access compiles classes and other resources. I created a small prove of concept project to illustrate the solution using SSHFS.
https://github.com/Jotschi/docker-junit-distribution-test