1
votes

I have an Atlassian Bamboo plan referring to my C# project. The tasks configured are as follows:

a) MSBuild task to build my C# solution file. b) NUnit Runner and NUnit Parser tasks to run the Unit tests. c) OpenCover task to execute the NUnit Unit tests and generate the metrics like Lines covered, Branch coverage etc. d) SonarQube Runner task to generate the code coverage metrics on SonarQube project.

The metrics are successfully generated at step c) and results are written out to .xml file as output of OpenCover command. But after step d), SonarQube runner executes successfully and shows the results on Sonar project in terms of Number of unit tests, tests passed, tests skipped, tests failed. But the Code Coverage column shows as "-" blank.

Please note that my C# solution as multiple projects and I have the sonar-project.properties file at the root (Solution) level. I use the following Sonar-project.properties file:

sonar.projectKey=<KeyName> (Key name of  C# project in SonarQube)
sonar.projectName=<ProjectName> (Project name in SonarQube) 
sonar.projectVersion=1.0
sonar.sources=.
sonar.language=cs
sonar.cs.nunit.reportsPaths=ABC.xml(Output of Nunit task)
sonar.cs.opencover.reportsPath=XYZ.xml(Output of OpenCover task)

Please guide me in this regard, any help will be greatly appreciated.

Thanks

1
Are the report paths correct - it can't be the same file for both? If so do you have coverage information in the OpenCover output file? I've had sonar working both locally hosted and against nemo.sonarsource.org - see post blog.many-monkeys.com/improving-your-source-codeShaun Wilde
@ShaunWilde: Yes, I do have two different output filenames for NUnit and Open Cover tasks. I am also able to see the Open Cover output such as Line Coverage, Branch Coverage etc in XYZ.xml file. But when I run the SonarQube Runner task (v 2.4) in Bamboo, it fails to show the populate the Code Coverage column in SonarQube report and shows as "-". However, all the other columns like Number of passed tests, failed tests are populated fine. So, I am not sure if I am missing any lines in Sonar-project properties file? Should I use a .bat file for Sonar Runner task?HKR

1 Answers

1
votes

Very late answer but it might help someone in the future:

You misspelled reportsPaths in your line

sonar.cs.opencover.reportsPath=XYZ.xml