6

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.

Assuming it's possible to integrate the reports generated by ReportGenerator into the CruiseControl.NET webapp, how do I integrate the two?

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.

Related thoughts / questions:

  • 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.
Daniel
  • 920
  • 7
  • 19
Kaleb Pederson
  • 45,767
  • 19
  • 102
  • 147
  • ReportGenerator can also produce a HTML output those files (or index.html) should be easily linkable. – Shaun Wilde Nov 09 '11 at 21:18
  • See this blog post http://www.palmmedia.de/Blog/2012/9/27/cruisecontrol-net-integration-of-coverage-reports for a tutorial. – Daniel Sep 27 '12 at 12:35

2 Answers2

8

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:

  1. Add a Target for Coverage
  2. Add a task to your build.proj for creating the OpenCoverage output (OpenCoverReport.xml)
  3. Right after after that, add a task for creating the Summary report using ReportGenerator (reporttypes:XML). Like so: MSBuild Coverage Target Example
  4. 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
  5. Add the buildReportBuildPlugin and xslReportBuildPlugin for creating both reports using the previous XSLT files in your dashboard.config file: Add this to the configuration
  6. Merge the coverage report summary XML file to the Build output, in your ccnet.config file: add this to your configuration
Marcel Valdez Orozco
  • 2,985
  • 1
  • 25
  • 24
  • Is it possible for you to post your entire configuration in the answer (would be easier to follow) - am trying to follow your steps but (1) and (2) are a little cryptic without examples... – Denis Mar 28 '14 at 20:49
  • The link in step 3 it shows the result of step 1 and 2 as well. – Marcel Valdez Orozco Apr 27 '14 at 15:31
  • thank you (also realized that later). But for some reason the XSLTs that are linked here don't produce any results for me. Do they work? – Denis May 08 '14 at 21:27
  • @ Marcel Valdez Orozco - Can you please clarify where the file in #6 came from? – Denis May 09 '14 at 15:08
2

You could use External Links in your ccnet.config after exposing your report via IIS

   <externalLinks>
     <externalLink name="Code Coverage"     url="http://cc.net/coverage" /> 
   </externalLinks>
fiat
  • 15,501
  • 9
  • 81
  • 103
  • seems that he can do that with the coverage reports generated by ReportGenerator then. Having never used CC I couldn't make that call thanks for the update... a +1 from me and welcome to SO :) – Shaun Wilde Jan 19 '12 at 21:39