This page is to track progress on NCover 4 integration
Current status: NOT IMPLEMENTED
Feel free to vote for SONARDOTNT-275
There is no longer a Gallio-specific runner for NCover 4 (/r:NCover3). NCover 4 can monitor any .NET program and collect coverage. The requirement is to configure a project in NCover Code Central and tell it what process to monitor (name or regexp of process name), and also add some filters to tell what modules are associated with the project.
Here is a sample configuration:
Once a project is configured in Code Central, measures will be automatically collected the next time a monitored program is run.
In order to start a coverage session and collect resulting data in the NCover 3 XML format, here are the commands you should run:
This first command will associate the collected data to a buildId (TODO ask NCover support what are the constraints on the buildId).
Then to retrieve data:
--execution value should match value provided in the previous --buildId
--file can only configure the file name. It is not possible to give a full path. Resulting file will be in working directory with name <filename>.nccov (coverage-report.nccov in our example).
SonarQube Integration, Step #1
- ask people to configure NCover project by themselves
- add a new parameter
sonar.ncover4.projectNamethat the user should provide for each project
- add a new parameter
- verify command output and if everything is fine, execute the following command with working directory = target/sonar:
- then parse coverage-report.nccov like we do currently for NCover 3
Limitations: manual configuration step required. No guarantee that NCover configuration (especially module names) matches SonarQube configuration (exclusions, ...). No way to differentiate Unit tests and ITs.
SonarQube Integration, Step #2
TODO find a way to automatically verify configuration of NCover project. Then create or update NCover project if necessary. Require an API. Question asked to NCover support. In this case we could make parameter
sonar.ncover4.projectName optional (and automatically generate a project name during first execution and reuse it later).
SonarQube Integration, Step #3
Run 2 executions of Gallio/NCover in order to separate unit tests and ITs. Question: should we have 2 separate projects in NCover Code Central or does 1 project for both is fine? With second option I fear history in Code Central will be broken as we will have alternatively
Unit test --> ITs --> Unit test --> ITs --> ...
I fear option 1 will not work because with 2 projects configured to monitor Gallio.Echo.exe they will both be fed by coverage data (except if Run --project argument actually works).