我可以合并来自单元和集成测试目标的 Emma 覆盖率数据吗?
我们使用构建链设置 TeamCity 构建,以便我们的单元测试和集成测试可以在由提交触发时并行运行:
- 构建链 - 依赖于:
- 单元测试
- 集成测试
我正在寻找一种方法,我们可以组合/合并构建链中单元和集成测试生成的覆盖率数据,以便我们可以更好地了解实际情况 代码被两者结合起来覆盖。
然后,计划是能够监视已提交代码的覆盖范围的变化,如果百分比下降,则可能会导致构建失败!
We have our TeamCity builds set up using a build chain, so that our unit tests and and integration tests can run in parallel when triggered by a commit:
- Build Chain - dependant on:
- Unit tests
- Integration tests
I am looking for a way that we can combine/merge the coverage data generated by the unit and integration tests in the build chain, so that we can get a better picture of how much actual code is covered by the two combined.
The plan then is to be able to monitor changes in coverage of committed code, and perhaps failing builds if percentages fall!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经设置了“构建链”目标,以便单元和集成目标中的覆盖文件(*.em、*.ec)可供使用。
我专门为构建链目标创建了一个 ant 构建文件(在 emma doco 的帮助下!):
...它将所有覆盖率文件合并到一个报告中!
report
的metrics
参数设置 html 报告的突出显示阈值,以便低于阈值的包和文件的百分比以红色突出显示。修改 xml 输出将允许我使用类似 andariel 的东西对结果运行 xpath,然后强制如果未达到阈值,构建就会失败!
I have set up the 'build chain' target so that the coverage files (*.em, *.ec) from the unit and integration targets are available to it.
I created an ant build file specifically for the build chain target (with help from the emma doco!):
...which merges all the coverage files into a single report!
The
metrics
parameter ofreport
sets the highlight threshold for the html report, so that the percentages against packages and files that are lower than the threshold are highlighted in red.Modifying the xml output will allow me to use something like andariel to run an xpath over the results, and then force the build to fail if thresholds are not met!
根据 TC 的 Emma 文档
我为解决此问题所做的工作如下:
-out emma.em
,并确保merge
选项设置为true
> 保存检测数据。
以重命名为默认名称。希望这可以帮助任何人获得一份累积的艾玛报道报告。
Per TC's Emma doc
What I did to workaround this is below:
-out emma.em
in teamcity build steps config, and make suremerge
option is set totrue
to preserve the instrumented data.<move file="$YOUR_PATH/emma.em" tofile="$YOUR_PATH/coverage.em"/>
to rename to the default one.Hope this helps whoever whats to have an accumulated emma coverage report.
我遇到的大多数代码覆盖工具似乎都没有办法组合来自不同或重叠子系统的测试结果。正如您所指出的,这是一项非常有用的能力。
我们的SD 测试覆盖率工具确实具有此功能,并且可用于Java、C、C++、C#、PHP 和 COBOL。事实上,SD 测试覆盖率工具可以将多种语言的测试覆盖率数据组合成单个整体结果,以便您可以获得多语言应用程序的测试覆盖率概述。它能够显示所有涉及的源语言的覆盖范围,并提供摘要报告。
Most of the code coverage tools I've encountered do not seem to have a way to combine test results from different or overlapping subsystems. As you have pointed out, this is a very useful ability.
Our SD Test Coverage tools do have this ability and are available for Java, C, C++, C#, PHP and COBOL. In fact, the SD test coverage tools can combine test coverage data from multiple languages into a single monolithic result, so that you can get an overview of test coverage for your multi-lingual applications. It is able to show the coverage on all the source langauges involved, as well as provide summary reports.