问题描述
|
我有一些使用NCover进行测试覆盖率分析的内部版本,有些使用DotCover。我将NCover / DotCover摘要报告合并到ccnet日志中,但是根据工具的不同,我需要将其拉出到ccnet \“ Coverage \”统计信息中的项也有所不同(因为报告的格式不同)。
对于NCover,我使用以下命令:
<statistics>
<statisticList>
<firstMatch name=\"Coverage\"
xpath=\"//coverageReport/project/@coverage\"
generateGraph=\"true\" />
</statisticList>
</statistics>
对于DotCover,我需要这样做:
<statistics>
<statisticList>
<firstMatch name=\"Coverage\"
xpath=\"//Root/@CoveragePercent\"
generateGraph=\"true\" />
</statisticList>
</statistics>
有什么办法可以同时指定两者吗?如果仅在statisticList中列出两个部分,则第二个总是赢(因此,如果我将DotCover列出第二个,则使用NCover的构建的coverage设置为零,因为找不到DotCover的统计信息)。我想要的是将该统计信息设置为NCover统计信息(如果存在)或设置为DotCover统计信息(如果存在)。
谢谢您的帮助!
解决方法
您可能可以在xpath表达式中执行OR,例如:
<statistics>
<statisticList>
<firstMatch name=\"Coverage\"
xpath=\"//Root/@CoveragePercent | //coverageReport/project/@coverage\"
generateGraph=\"true\" />
</statisticList>
</statistics>