问题描述
我正在尝试将 OpenCover 与 CruiseControl.NET .至此,我已经通过构建系统进行了修改,因此它可以在OpenCover下运行我的nunit测试.然后,我使用 ReportGenerator 的那些报告生成Xml和Html报告.
I'm trying to integrate OpenCover with CruiseControl.NET. At this point I've modified by build system so it runs my nunit tests under OpenCover. I then generate Xml and Html reports from those using ReportGenerator.
假设可以将ReportGenerator生成的报告集成到CruiseControl.NET Web应用程序中,如何将两者集成在一起?
Assuming it's possible to integrate the reports generated by ReportGenerator into the CruiseControl.NET webapp, how do I integrate the two?
NCover有它自己的 NCoverReporting任务,但与我一样'未运行NCover,我无法将其输出与OpenCover生成的XML报告进行比较.
NCover has it's own NCoverReporting task that can be used, but as I'm not running NCover I can't compare its output with the XML reports generated by OpenCover.
相关想法/问题:
- OpenCover默认情况下会生成一个XML文件,但是cc.net可以使用该XML文件吗?
- ReportGenerator还会生成XML,它们是否打算用于cc.net之类的东西?
- cc.net具有一个文件合并发布者,它可以合并日志,但是我尚未找到任何文档来说明cc.net有用/使用的文件格式.
- OpenCover generates an XML file by default, but is that XML file consumable by cc.net?
- ReportGenerator also generates XML, are they intended for something like cc.net?
- cc.net has a File-Merge publisher that merges logs, but I haven't yet found any documentation indicating which file formats are useful/used by cc.net.
推荐答案
我遇到了这个问题,并通过以下步骤解决了这个问题,请考虑到我正在使用msbuild,因此只有在使用msbuild时,此方法才有效:
I had this problem and I solved it with these steps, take into account that I'm using msbuild, so this will only work if you're using msbuild:
- 添加覆盖率目标
- 将一个任务添加到build.proj中,以创建OpenCoverage输出(OpenCoverReport.xml)
- 此后,添加一个使用以下命令创建摘要"报告的任务ReportGenerator(报告类型:XML).像这样: MSBuild覆盖率目标示例
- 创建XSL转换以使用Summary.xml创建HTML输出,请放心,我已经编写了它:对于解析程序集级别的覆盖范围(在您的构建日志输出中),请使用以下命令: XSLT以获得程序集级别的覆盖率报告并解析类级别的覆盖率(详细报告),请使用以下命令: XSLT以获得类级别的覆盖率报告
- 添加buildReportBuildPlugin和xslReportBuildPlugin以使用仪表板中的先前XSLT文件创建两个报告.添加此内容到配置
- 将覆盖率报告摘要XML文件合并到ccnet.config文件中的Build输出中:将此添加到您的配置
- Add a Target for Coverage
- Add a task to your build.proj for creating the OpenCoverage output (OpenCoverReport.xml)
- Right after after that, add a task for creating the Summary report usingReportGenerator (reporttypes:XML). Like so: MSBuild Coverage Target Example
- Create the XSL Transforms for creating HTML output with the Summary.xml, don't worry I wrote it already: For parsing assembly level coverage (in your build log output) use the following: XSLT for an Assembly level coverage report and for parsing the Class level coverage (detailed report) use the following: XSLT for a Class level coverage report
- Add the buildReportBuildPlugin and xslReportBuildPlugin for creating both reports using the previous XSLT files in your dashboard.config file: Add this to the configuration
- Merge the coverage report summary XML file to the Build output, in your ccnet.config file: add this to your configuration
这篇关于使OpenCover报告在CruiseControl.NET中可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!