Reputation: 1270
I've set up SonarQube and integrated it with our on-prem TFS build server, which is working fine except for one feature - code coverage. For some reason, it's not detecting any code coverage results even though the second SonarQube step is picking up .trx files.
The "code coverage enabled" tickbox is ticked and within TFS, I am getting code coverage metrics:
However, SonarQube isn't displaying coverage:
When I check the build logs, it does appear that SonarQube is picking up the necessary file:
However it's just not processing coverage. What could I have missed?
TFS is Version 15.112.26307.0
SonarQube is version 6.5
Upvotes: 4
Views: 1607
Reputation: 30372
There is a regression bug in either the Scanner for MSBuild or the VSTS extension that cause code coverage file to not being automatically imported if the user doesn't specify the report path.
As mentioned in the linked thread, you can fix this issue by adding /d:sonar.cs.vscoveragexml.reportsPaths="**\*.coveragexml"
into the Advanced > Additional Settings of the SonarQube Scanner for MSBuild - Begin Analysis (new) task.
Note : make sure you have enabled the Code Coverage Enabled in Test Assemblies step.
Upvotes: 6