0
votes

I'm running SonarQube 5.2 with SonarRunner v2.4 (MSBuild) and am having issues getting SonarRunner to pick up the code coverage reports. I have VS Test which drops the TestResults folder within the source directory. The TRX file is within the TestResults folder. Is there a default directory that Sonar-Runner scans to search for the TRX/code coverage reports? The build succeeds but there are no unit test coverage results in SonarQube for the app.

TRX: F:\Builds\50\IT\ABCDemo.Nightly\src\TestResults\ *.TRX

Source: F:\Builds\50\IT\ABCDemo.Nightly\src

Process:

  • SonarRunner begin //with key,name,version filled in
  • MSBuild executes
  • VS Test executes and drops TestResults folder within src directory.
  • SonarRunner end

Issue:

MSBuild SonarQube Runner Post-processor 1.0.2.0

09:22:57.327 Fetching code coverage report information from TFS...

09:23:17.723 No code coverage reports were found for the current build.


EDIT: I've included the .TRX and .coveragexml files using /d: but I still get the issue saying no code coverage reports were found.

I can see in the logs that it does:

09:51:59.875 INFO - Parsing the Visual Studio coverage XML report f:\Builds\50\IT\ABCDemo.Nightly\src\VisualStudio.coveragexml

09:53:07.737 INFO - Parsing the Visual Studio Test Results file f:\Builds\50\IT\ABCDemo.Nightly\src\TestResults\tfsbuildagent_QL1CIBUILD3 2015-12-03 09_51_33.trx

These occur near the end of sonar analysis.

1

1 Answers

0
votes

Resolved by:

Included the paths to the files for trx and coveragexmls within the arguments for sonar-runner.

MSBuild.SonarQube.Runner.exe begin
/k:projectkey /n:projectname /v:projectversion
/d:sonar.cs.vstest.reportsPaths="path\to\ *.trx" /d:sonar.cs.vscoveragexml.reportsPaths="path\to\VisualStudio.coveragexml"

Moved the /'s around for better visual.