# Overview

Test coverage reports and test execution reports are important metrics in assessing the quality of your code. Test coverage reports tell you what percentage of your code is covered by your test cases. Test execution reports tell you which tests have been run and their results.

SonarQube itself does not calculate coverage. To include coverage results in your analysis, you must set up a third-party coverage tool and configure SonarQube to import the results produced by that tool.

Below, you’ll find guidelines and resources, as well as language- and tool-specific analysis parameters.

## General guidelines <a href="#general-guidelines" id="general-guidelines"></a>

Before importing test coverage, you need to have the appropriate SonarScanner configured to perform code analysis as part of your build pipeline.

To enable coverage reporting, you must then do the following:

1. Set up your coverage tool to run as part of your build pipeline. Your coverage tool should be set up to run *before* the SonarScanner analysis.
2. Configure the coverage tool so that the location and format of the output report files match what the SonarScanner expects.
3. Configure the analysis parameters of the SonarScanner so that it can import the report files.

Now, on each build of your project, your coverage tool should perform its analysis and output its results to one or more files (usually one for test coverage and one for test execution). Then, the SonarScanner, as part of its analysis process, will import those files and send the results to SonarQube.

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

SonarQube directly supports the import of coverage data in formats native to a variety of tools for a variety of languages. It also supports the import of a [generic-test-data](https://docs.sonarsource.com/sonarqube-server/9.8/analyzing-source-code/test-coverage/generic-test-data "mention") that can be used as a target for custom conversion of reports from tools that are not directly supported.

### Detailed guides <a href="#detailed-guides" id="detailed-guides"></a>

Detailed guides for the following languages are provided in this section:

* [java-test-coverage](https://docs.sonarsource.com/sonarqube-server/9.8/analyzing-source-code/test-coverage/java-test-coverage "mention")
* [javascript-typescript-test-coverage](https://docs.sonarsource.com/sonarqube-server/9.8/analyzing-source-code/test-coverage/javascript-typescript-test-coverage "mention")
* [dotnet-test-coverage](https://docs.sonarsource.com/sonarqube-server/9.8/analyzing-source-code/test-coverage/dotnet-test-coverage "mention")
* [python-test-coverage](https://docs.sonarsource.com/sonarqube-server/9.8/analyzing-source-code/test-coverage/python-test-coverage "mention")
* [php-test-coverage](https://docs.sonarsource.com/sonarqube-server/9.8/analyzing-source-code/test-coverage/php-test-coverage "mention")
* [c-family-test-coverage](https://docs.sonarsource.com/sonarqube-server/9.8/analyzing-source-code/test-coverage/c-family-test-coverage "mention")

### Generic format <a href="#generic-format" id="generic-format"></a>

See [generic-test-data](https://docs.sonarsource.com/sonarqube-server/9.8/analyzing-source-code/test-coverage/generic-test-data "mention") for information on how the generic format works.

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

See [test-coverage-parameters](https://docs.sonarsource.com/sonarqube-server/9.8/analyzing-source-code/test-coverage/test-coverage-parameters "mention") for a reference on all coverage-related analysis parameters.

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

This section is about *test coverage reports*, that is, reports that describe the percentage of your code that is tested by your test suite during a build.

Test execution reports are a separate feature. These describe which tests within your tests suite are executed during a build. For details, see [test-execution-parameters](https://docs.sonarsource.com/sonarqube-server/9.8/analyzing-source-code/test-coverage/test-execution-parameters "mention").
