I have a build where I run some tests and then instrument the code with OpenCoverage to produce a coverage report which I would like to push to SonarQube.
This is a C sharp project and the build is using the MSBuild engine; the tests are run with XUnit; the coverage results are produced with OpenCover. The three of these tools are run through Cake build’s API.
While the Code Analysis task is run (in the TFS server), a warning is printed to the log stating that coverage has been skipped because OpenCover was not found.
WARNING: Failed to find the code coverage command line tool. Possible cause: Visual Studio is not installed, or the installed version does not support code coverage.
Unfortunately installing Visual Studio in the agent is not an option for me.
The OpenCover executable is loaded as a tool in the Cake runtime folder and the coverage task does produce a correct file with the results.
So, I believe I’ve got two options to solve this, in order of what I feel is best for my case, they are:
- Push the coverage results file produced in the coverage task to SonarQube.
- Tell SonarQube that the OpenCover executable is not in the default location it’s looking for but in the Cake’s tool path.
Are there any other options?
How could I accomplish one and two?