0

When I run opencover through the command prompt it generates a xml, then i run report generator and it creates the html documents in the correct folder, but when i force a build, these don't happen, is this the correct way to do it? this what's setup in my ccnet.config

  <!-- Open Cover -->
<tasks>
  <exec>
    <executable>C:\Program Files (x86)\OpenCover\OpenCover.Console.exe</executable>
    <buildargs>-target:"C:\Program Files (x86)\NUnit 2.6.2\bin\nunit-console.exe" -register:user -targetargs:"/nologo /noshadow \"C:\Users\username\Documents\Visual Studio 2010\Projects\WebCrawlerMVC\WebCrawlerMVC.Tests\bin\Debug\WebCrawlerMVC.Tests.dll" -filter:+[WebCrawlerMVC]* -output:coverage.xml </buildargs>
  </exec>
  <!-- Report Generator -->
  <exec>      
    <executeable>C:\Program Files (x86)\ReportGenerator\bin\ReportGenerator.exe</executeable>
    <buildargs>-reports:"C:\Program Files (x86)\OpenCover\coverage.xml" -targetdir:"C:\Program Files (x86)\CruiseControl.NET\server\WebCrawlerMVC\Artifacts\Reports" -reporttypes:XML;HTML</buildargs>
  </exec>
</tasks>
Lewis
  • 2,373
  • 2
  • 22
  • 30

1 Answers1

1

Some time ago I created a tutorial. You find it here: http://www.palmmedia.de/Blog/2012/9/27/cruisecontrol-net-integration-of-coverage-reports

The only mistake I can see in your configuration is, that you placed the quotes at the wrong position. Use

"-reports:C:\Program Files (x86)\OpenCover\coverage.xml"

instead of

-reports:"C:\Program Files (x86)\OpenCover\coverage.xml"

Daniel
  • 920
  • 7
  • 19
  • I see, $[$CCNetArtifactDirectory]\$[$CCNetLabel] does this interact with the ccnet build for the Artifacts folder? – Lewis Jan 18 '13 at 13:07
  • Yes. You could use any folder you like here, but if you want to include the HTML report into the dashboard via htmlReportPlugin, then you have to use this folder. – Daniel Jan 18 '13 at 13:09
  • Iv'e changed my code to use this instead, but the response on the html report = An error occurred while retrieving the file: Request processing has failed on the remote server: The given path's format is not supported. – Lewis Jan 18 '13 at 13:10
  • @Daniel: In your tutorial; you showed the use of opencover for one assembly. What if I want to run OpenCover on multiple test assemblies? – Ram Jan 13 '15 at 15:21
  • Then you have to pass all your test DLLs to your test runner. The OpenCover report will contain the results for all test assemblies. If you execute OpenCover separately for each assembly, then you can pass several reports to ReportGenerator: -reports:"coverage1.xml;coverage2.xml" – Daniel Jan 13 '15 at 16:38