简体   繁体   English

测试套件的增量运行

[英]Incremental run of testsuite

We have a large project that has several thousands of tests in the testsuite, and the full testsuite run takes very long time.我们有一个大型项目,测试套件中有数千个测试,完整的测试套件运行需要很长时间。

I am looking for a tool that I can integrate in the Maven build that will run only those tests that might be affected (knowing code coverage for each), because some covered code has changes.我正在寻找一种可以集成到 Maven 构建中的工具,该工具将仅运行那些可能受到影响的测试(了解每个测试的代码覆盖率),因为某些覆盖的代码发生了变化。

I was googling that and found a few similar things but not a perfect fit:我在谷歌上搜索并发现了一些类似的东西,但并不完美:

  • Ekstazi http://www.ekstazi.org/ looks like exactly that, but it does not work out-of-the box with TestNG (used in the testsuite), and it is not open source Ekstazi http://www.ekstazi.org/看起来正是这样,但它不能与 TestNG(在测试套件中使用)开箱即用,并且它不是开源的
  • Infinitest https://infinitest.github.io/ seems to focus mainly on IDE integration - is it possible to run the tests only on demand (just like mvn infinitest )? Infinitest https://infintest.github.io/似乎主要关注 IDE 集成 - 是否可以仅按需运行测试(就像mvn infinitest一样)?
  • PIT http://pitest.org/ is not exactly what I am looking for but it also needs to analyze per-test coverage PIT http://pitest.org/并不是我正在寻找的,但它也需要分析每个测试的覆盖率

It would be also very useful to remember test coverage with (last) git commit and run the tests against the last code changes.记住(最后) git commit 的测试覆盖率并针对最后的代码更改运行测试也非常有用。

Further suggestions and comments on those above are welcome.欢迎对上述内容提出进一步的建议和意见。

As far as I can see, Infinitest doesn't provide corresponding Maven plugin, so it's impossible to do using it.据我所知,Infinitest没有提供相应的Maven插件,所以无法使用。 You may consider creating it though, making an invaluable contribution to the world.你可以考虑创造它,为世界做出无价的贡献。

As far as I can see, it provides pretty solid API so writing a plugin shouldn't be a big problem.据我所知,它提供了非常可靠的 API,因此编写插件应该不是什么大问题。 You may want to take a look at InfinitestCore interface first.您可能想先看看InfinitestCore界面。 If you're using a CI environment you may want to provide file list for the Infinitest directly from git diff --name-only HEAD~1 which will produce the list of files changed in latest commit (as an example, if you run your builds against each commit).如果您使用的是 CI 环境,您可能希望直接从git diff --name-only HEAD~1为 Infinitest 提供文件列表,这将生成在最新提交中更改的文件列表(例如,如果您运行针对每个提交构建)。

UPD .更新 It seems like there's a workaround involving maven-exec-plugin to explicitly run Infinitest in the Maven build: you can run 'mvn exec:exec' from the command line or from m2eclipse's Maven Build launcher to run Infinitest against your project.似乎有一个涉及 maven-exec-plugin 在 Maven 构建中显式运行 Infinitest 的解决方法:您可以从命令行或从 m2eclipse 的 Maven Build 启动器运行 'mvn exec:exec' 以针对您的项目运行 Infinitest。 I'd advice specifying the explicit build phase on which it should be run using the executions element in POM :我建议使用POM 中executions元素指定应该在其上运行的显式构建阶段:

executions: It is important to keep in mind that a plugin may have multiple goals.执行:重要的是要记住一个插件可能有多个目标。 Each goal may have a separate configuration, possibly even binding a plugin's goal to a different phase altogether.每个目标可能有一个单独的配置,甚至可能将插件的目标完全绑定到不同的阶段。 executions configure the execution of a plugin's goals. executions 配置插件目标的执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM