Code Coverage in Sonar Builds with MS Build SonarQube Runner v1.0.1 -
i'm trying code coverage in sonar build using ms build sonarqube runner v1.0.1. wrote script copied verbatim documentation generating code coverage results vstest , run post-build script, passing in test dlls arguments, , adding necessary property key (/d:sonar.cs.vscoveragexml.reportspaths="%cd%\visualstudio.coveragexml") beginning script arguments.
the script runs, coverage binary , coverage xml generated (with valid data in xml), ms build sonarqube runner runs, , stats uploaded sonar - except code coverage results. see works when set static location, e.g. c:\tmp\visualstudio.coveragexml, isn't approach when trying set many sonar builds.
here's screenshot of tfs build definition:
here's codecoverage.bat (copied documentation stated)
"%vsinstalldir%\team tools\dynamic code coverage tools\codecoverage.exe" collect /output:"%cd%\visualstudio.coverage" "%vsinstalldir%\common7\ide\commonextensions\microsoft\testwindow\vstest.console.exe" %* "%vsinstalldir%\team tools\dynamic code coverage tools\codecoverage.exe" analyze /output:"%cd%\visualstudio.coveragexml" "%cd%\visualstudio.coverage"
%cd% batch variable, , not sure correctly expanded within tfs 2013. check if tfs 2013 doesn't provide environment variable can use compute absolute path code coverage report: https://msdn.microsoft.com/en-us/library/hh850448.aspx#env_vars
moreover, don't need manually set sonar.cs.vscoveragexml.reportspaths (or manually convert binary coverage report xml) when you're analyzing project tfs 2013 - see https://github.com/sonarsource/sonar-.net-documentation/blob/master/doc/analyze-from-tfs.md ("optional - configure code coverage")
Comments
Post a Comment