NCover Reporting in Bamboo
Asked by Benjamin Rice:

So Bamboo Reporting allows me to select NCover reports as a custom report type, but all the documentation says about NCover anywhere is "DO not select this \['NCover Output will be produced'\] option" in "Configuring Miscellaneous Settings for a Job". So has anyone out there implemented NCOver with a Bamboo build? Did you do it by adding it as a task in your MSBuild (or NAnt) script? We are movign from CCNet and had CCNet run NCover as a task. I don't see that anyone has done a plugin for NCover for Bamboo yet, so thinking that we will need to run it as the MSBuild task (or find a bunch of extra time to create our own plugin).


Answers:
author: Russell Hinson
body: Understood and thanks for the detailed update.

Regarding the Line Rate Coverage, see the link below for some relevant info:

<https://answers.atlassian.com/questions/19807/ncover-calculation-is-not-correct?sort=votes>

Maybe Atlassian has modifed this report, as it seems it was of limited usefulness before, but now it seems there may be another problem. I couldn't find details of how this issue was resolved.


author: Russell Hinson
body: Hi benrice,

Recently, an NCover customer who was using Bamboo figured out how to display an NCover report by trial-and-error and ingenuity -- as you observed, the Bamboo documentation isn't much help, and NCover doesn't offer a plug-in, so he figured it out on his own.

Based on the steps he described to me, I put together a short knowledge base article that may help you:

<http://docs.ncover.com/kb/displaying-ncover-results-in-bamboo/>

Best regards,

NCover Support

comments: author: Benjamin Rice
body: I'm not sure what version of Bamboo that user used, but Command is not an option one can select in the Miscellaneous configuration of the job in Bamboo 3.4.1. However, I could point that configuration option to an NCover coverage.xml file. I then created a Command task in the job to be run after my build task. I set NCover.Console to the executable to be run and give it the parameters to run MSTest: "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\MSTest.exe" /testcontainer:.\\ProjectTests\\bin\\debug\\ProjectTests.dll // .\\coverage\\coverage.xml

That works to create my coverage file in the place I specified in the job's miscellaneous configuration. After running the build I can see the results when I go to Project \> Plan \>Build #\> Job in the NCover tab that now appears. However, if I go to Project \> Plan \> Job (without the specific build) there is also an NCover tab that shows 'Line Rate Coverage' and a broken image, which I assume should be the coverage graph. Also, if I go to Reports and select NCover Code Coverage for the given plan no data is returned.


author: Daniel Turner
body: Same problem here benrice, did you ever end up getting this working?

This is the nant call that I am using:  

\<ncover program="${tools.NCover.Console.exe}"  
testRunnerExe="${tools.nunit-console.exe}"  
testRunnerArgs="${source.directory}\\${solution.name}.sln /xml=${results.directory}\\unit\\${solution.name}.xml"  
coverageFile="${results.directory}\\cover\\xml\\coverage.xml"  
htmlReportDir="${results.directory}\\cover\\html"  
includeAssemblies="${solution.name}.\*"  
excludeAssemblies=".\*Tests.\*;QTAgent32;"\>  
\</ncover\>

(testRunnerArgs are actually on one line, Atlassian Answers has dropped it over two)

<br />

I can see this correctly gives me a coverage xml file at "\\testresults\\cover\\xml\\coverage.xml"

I then have the plan configured with "NCover output will be produced" ticked, and the directory as "testresults\\cover\\xml".

This results in a broken image for Line Rate Coverage for me too.


author: Benjamin Rice
body: Dan,

I did not get that working. I ended up copying off the NCover reporting html files as artifacts, and the team can view them from there. I didn't work on getting trending to work at all though.

Ben


Tags: coverage

ncover

test