I am running analysis on my solution which contains a Unit Test project just like any other projects . But there is 'No Data' in Unit Test Coverage Widgets .But I can see the analysis if I open respective folder/file of UT . How can I see Unit Test Coverage details by adding widget.
Asked
Active
Viewed 7,372 times
1

Raq
- 433
- 1
- 7
- 20
-
Which coverage tools do you use (JaCoCo / Cobertura) or how do you execute analysis? – agabrys Jun 27 '18 at 19:07
-
I am not using any of these tools...i am running analysis with sonar scanner. – Raq Jun 28 '18 at 06:18
1 Answers
4
I am not using any of these tools...i am running analysis with sonar scanner.
SonarQube doesn't generate code coverage data. It displays data provided by reports generated by other tools. You have to configure and execute any code coverage tool and then scanner will upload results to the server.
See how to do it for C#: Code Coverage Results Import (C#, VB.NET)
More about code coverage: Seeing Coverage

agabrys
- 8,728
- 3
- 35
- 73
-
Hi agabrys, is VS2015 enterprise capable of generating test coverage reports,which can be used later by sonar scanner? If it is then i would upgrade to VS2015 enterprise currently i'm using VS2015 professional and it doesn't have 'Analyze Code Coverage' option under Test menu. – Raq Jul 12 '18 at 11:43
-
You have to execute a code coverage tool on your build server (which executes Sonar analysis). `Analyze Code Coverage` from VS2015 won't help you. Read this topic about code coverage tools: https://stackoverflow.com/q/276829/4944847 – agabrys Jul 12 '18 at 12:22
-
But the sonarqube link u have given suggests Visual Studio Code coverage as one of the 4 ways given to get code coverage result . Does 'Visual Studio Code Coverage' suggests something else here than 'Analyze code coverage' under test menu? I was assuming that the .coveragexml can be exported from VS and can be used by sonar scanner. – Raq Jul 12 '18 at 12:46
-
But it means you have to do it manually. Do you execute analysis on CI or your laptop/PC? – agabrys Jul 12 '18 at 12:48
-
Can I not generate .coveragexml from VS and use the same to get unit test coverage result in sonarqube without involving any external tools ? – Raq Jul 12 '18 at 13:16
-
If you want to execute it manually then you could use it. I don't have VS → I don't how to do it. – agabrys Jul 12 '18 at 18:31