# Source: https://docs.sonarsource.com/sonarqube-server/8.9/analyzing-source-code/test-coverage-and-execution.md

# Test coverage and execution

This page lists analysis parameters related to test coverage and execution reports. For more other parameters, see [analysis-parameters](https://docs.sonarsource.com/sonarqube-server/8.9/analyzing-source-code/analysis-parameters "mention").

SonarQube doesn’t run your tests or generate reports. It only imports pre-generated reports. Below you’ll find language- and tool-specific analysis parameters for importing coverage and execution reports.

In the [guides](https://community.sonarsource.com/c/announce/guides) category of the [Sonar community forum](https://community.sonarsource.com/) you might find instructions on generating these reports.

Some properties support the following wildcards in paths. The remarks for properties that support wildcards will mention that fact. If the remarks do not say wildcards are supported, then they are not.:

|            |                           |
| ---------- | ------------------------- |
| **Symbol** | **Meaning**               |
| `?`        | a single character        |
| `*`        | any number of characters  |
| `**`       | any number of directories |

### Test Coverage <a href="#test-coverage" id="test-coverage"></a>

Unless otherwise specified, these properties require values that are relative to project root.

|                             |                                           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| --------------------------- | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Language**                | **Property**                              | **Remarks**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| **Any**                     | `sonar.coverageReportPaths`               | Path to coverage report in the [generic-test-data](https://docs.sonarsource.com/sonarqube-server/8.9/analyzing-source-code/generic-test-data "mention") format.                                                                                                                                                                                                                                                                                                                                                                          |
| Apex                        | `sonar.apex.coverage.reportPath`          | Path to the `test-result-codecoverage.json` report file generated by the [`apex:test:run`](https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_apex.htm?search_text=apex%20test#cli_reference_test_run) command of the [Salesforce CLI](https://developer.salesforce.com/tools/sfdxcli). Note, you must have a [Salesforce DX project](https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_workspace_setup.htm) set up and linked to your Org |
| C / C++ / Objective-C       | `sonar.cfamily.gcov.reportsPath`          | Path to the directory containing native `*.gcov` reports (not the XML reports generated by gcovr)                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| C / C++ / Objective-C       | `sonar.cfamily.llvm-cov.reportPath`       | Path to a llvm-cov report                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| C / C++ / Objective-C       | `sonar.cfamily.vscoveragexml.reportsPath` | Path may be absolute or relative to the solution directory. Path wildcards (see above) are supported. Note that the `.coveragexml` report format offered by Visual Studio is not supported.                                                                                                                                                                                                                                                                                                                                              |
| C / C++ / Objective-C       | `sonar.cfamily.bullseye.reportPath`       | Path to the report from Bullseye, version >= 8.9.63 (use [covxml](http://www.bullseye.com/help/ref-covxml.html) tool)                                                                                                                                                                                                                                                                                                                                                                                                                    |
| C#                          | `sonar.cs.vscoveragexml.reportsPaths`     | Path to Visual Studio Code Coverage report. Multiple paths may be comma-delimited, or included via wildcards. See *Notes on importing .NET reports* below.                                                                                                                                                                                                                                                                                                                                                                               |
| C#                          | `sonar.cs.dotcover.reportsPaths`          | Path to dotCover coverage report. See *Notes on importing .NET reports* below.                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| C#                          | `sonar.cs.opencover.reportsPaths`         | Path to OpenCover coverage report. See *Notes on importing .NET reports* below.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| C#                          | `sonar.cs.ncover3.reportsPaths`           | **Deprecated.** Path to NCover3 coverage report. See *Notes on importing .NET reports* below.                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Flex                        | `sonar.flex.cobertura.reportPaths`        | Path to the Cobertura XML reports. Multiple paths may be comma-delimited. May be absolute or relative to the project base directory.                                                                                                                                                                                                                                                                                                                                                                                                     |
| Go                          | `sonar.go.coverage.reportPaths`           | Comma-delimited list of paths to coverage report files. Path wildcards are supported (see above) since SonarGo 1.1.                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Java / Kotlin / Scala / JVM | `sonar.coverage.jacoco.xmlReportPaths`    | Path to JaCoCo XML coverage reports. Path wildcards are supported (see above).                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| JavaScript / TypeScript     | `sonar.javascript.lcov.reportPaths`       | Comma-delimited list of paths to LCOV coverage report files. Paths may be absolute or relative to project root.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| PHP                         | `sonar.php.coverage.reportPaths`          | Comma-delimited list of paths to Clover XML-format coverage report files. Paths may be absolute or relative to project root.                                                                                                                                                                                                                                                                                                                                                                                                             |
| Python                      | `sonar.python.coverage.reportPaths`       | Comma-delimited list of paths to coverage reports in the Cobertura XML format. Path wildcards are supported (see above). Leave unset to use the default (`coverage-reports/*coverage-*.xml`).                                                                                                                                                                                                                                                                                                                                            |
| Ruby                        | `sonar.ruby.coverage.reportPaths`         | Comma-delimited list of paths to SimpleCov report files generated with the [JSON formatter](https://github.com/simplecov-ruby/simplecov#json-formatter) (availaible from SimpleCov 0.20). For SimpleCov versions < 0.18, you can provide `.resultset.json` report files (not recommended). Paths may be absolute or relative to project-root.                                                                                                                                                                                            |
| Scala                       | `sonar.scala.coverage.reportPaths`        | Comma-separated list of paths to `scoverage.xml` report files generaged by Scoverage.                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Swift, Xcode 9.3+           |                                           | You can use the [xccov-to-sonarqube-generic.sh](https://github.com/SonarSource/sonar-scanning-examples/blob/master/swift-coverage/swift-coverage-example/xccov-to-sonarqube-generic.sh) script from the [sonar-scanning-examples/swift-coverage](https://github.com/SonarSource/sonar-scanning-examples/tree/master/swift-coverage) project convert output from Xcode 9.3’s xccov tool to the [generic-test-data](https://docs.sonarsource.com/sonarqube-server/8.9/analyzing-source-code/generic-test-data "mention") format.           |
| Swift, Xcode 7-9.2          | `sonar.swift.coverage.reportPath`         | Path to the report generated by `llvm-cov show`. Path may be absolute or relative to project root.                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| VB.NET                      | `sonar.vbnet.vscoveragexml.reportsPaths`  | Path to Visual Studio Code Coverage report. Multiple paths may be comma-delimited, or included via wildcards. See *Notes on importing .NET reports* below.                                                                                                                                                                                                                                                                                                                                                                               |
| VB.NET                      | `sonar.vbnet.dotcover.reportsPaths`       | Path to dotCover coverage report. See *Notes on importing .NET reports* below.                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| VB.NET                      | `sonar.vbnet.opencover.reportsPaths`      | Path to OpenCover coverage report. See *Notes on importing .NET reports* below.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| VB.Net                      | `sonar.vbnet.ncover3.reportsPaths`        | **Deprecated.** Path to NCover3 coverage report. See *Notes on importing .NET reports* below.                                                                                                                                                                                                                                                                                                                                                                                                                                            |

### Test Execution <a href="#test-execution" id="test-execution"></a>

Unless otherwise specified, these properties require values that are relative to project root.

|                         |                                     |                                                                                                                                                                                                                                                                                                                                                                                 |
| ----------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Language**            | **Property**                        | **Remarks**                                                                                                                                                                                                                                                                                                                                                                     |
| **All**                 | `sonar.testExecutionReportPaths`    | Comma-delimited list of paths to execution reports in the [generic-test-data](https://docs.sonarsource.com/sonarqube-server/8.9/analyzing-source-code/generic-test-data "mention") format.                                                                                                                                                                                      |
| C / C++ / Objective-C   | `sonar.cfamily.cppunit.reportsPath` | Path to the directory holding the [CPPUnit](http://sourceforge.net/projects/cppunit/) reports. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.                                                                                                                                                                  |
| C#                      | `sonar.cs.vstest.reportsPaths`      | Paths to VSTest reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.                                                                                                                                                                      |
| C#                      | `sonar.cs.nunit.reportsPaths`       | Paths to NUnit execution reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.                                                                                                                                                             |
| C#                      | `sonar.cs.xunit.reportsPaths`       | Paths to xUnit execution reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.                                                                                                                                                             |
| Go                      | `sonar.go.tests.reportPaths`        | Comma-delimited list of paths to unit test report files. Paths may be absolute or relative to project root.                                                                                                                                                                                                                                                                     |
| Java / Kotlin           | `sonar.junit.reportPaths`           | Comma-delimited list of paths to Surefire XML-format reports.                                                                                                                                                                                                                                                                                                                   |
| JavaScript / TypeScript |                                     | You can use [jest-sonar-reporter](https://www.npmjs.com/package/jest-sonar-reporter) or [karma-sonarqube-unit-reporter](https://github.com/tornaia/karma-sonarqube-unit-reporter) to create reports in the [generic-test-data](https://docs.sonarsource.com/sonarqube-server/8.9/analyzing-source-code/generic-test-data "mention") format. Both packages are available on npm. |
| PHP                     | `sonar.php.tests.reportPath`        | Path to the PHPUnit unit test execution report file. Path may be absolute or relative to project root.                                                                                                                                                                                                                                                                          |
| Python                  | `sonar.python.xunit.reportPath`     | Path to unit test execution report. Leave unset to use the default (`xunit-reports/xunit-result-*.xml`). Path wildcards (see above) are supported. If any paths in the report are invalid, set `sonar.python.xunit.skipDetails=true` to collect only project-level details.                                                                                                     |
| VB.NET                  | `sonar.vbnet.vstest.reportsPaths`   | Paths to VSTest execution reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.                                                                                                                                                            |
| VB.NET                  | `sonar.vbnet.nunit.reportsPaths`    | Paths to NUnit execution reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.                                                                                                                                                             |
| VB.NET                  | `sonar.vbnet.xunit.reportsPaths`    | Paths to xUnit execution reports. Multiple paths may be comma-delimited, or included via wildcards. Note that while measures such as the number of tests are displayed at project level, no drilldown is available.                                                                                                                                                             |

### Importing .NET reports <a href="#importing-dotnet-reports" id="importing-dotnet-reports"></a>

To import .NET reports, the report generation process must be executed after the begin step and before the end MSBuild command. The following steps detail importing .NET reports:

1. Run the SonarScanner.MSBuild.exe `begin` command, specifying the absolute path where the reports *will be* available using the `/d:propertyKey="path"` syntax ("propertyKey" depends on the tool)
2. Build your project using MSBuild
3. Run your test tool, instructing it to produce a report at the same location specified earlier to the MSBuild SonarQube Runner ([How to generate reports with different tools](https://community.sonarsource.com/t/coverage-test-data-generate-reports-for-c-vb-net/9871))
4. Run the SonarScanner.MSBuild.exe `end` command

For more information, see the [Generate Reports for C#, VB.net Community Post](https://community.sonarsource.com/t/coverage-test-data-generate-reports-for-c-vb-net/9871).