Skip to end of metadata
Go to start of metadata

If coverage information is available on your project, then the coverage tab can help you visualize where test coverage is missing. Depending on the configuration of your project (and also on the capability of the language plugin covering your project), you have access to:

  • coverage by unit tests
  • coverage by integration tests

In either case, the component viewer behaves the same. Once you activate the decoration, 2 new columns are added on the left border of the source code:

  • The first one displays the line coverage
    • It's green if the line is covered by at least one test
  • The second one displays the branch coverage
    • It's available only on lines of code that have conditions
    • It displays how many branches are covered out of all the branches 

In the example below, activating the "Branches to cover" filter allows you to focus on branch coverage:

Time Changes for coverage works only if SCM Activity Plugin is installed

Icon

Selecting a period in the coverage header displays the coverage on new code during the given period. SonarQube needs the SCM information to be able to compute this information (i.e. to know exactly which lines were touched in the selected period).

Coverage per tests

For Java projects using the JaCoCo plugin, it's possible to have "coverage per test" information. This includes:

  • Displaying the number of different tests that cover a specific line
  • Listing those tests
  • Being able to navigate to the test files that define those tests

Clicking on a link in the popup window navigates to the test file and the content of this popup is saved in the the workspace:

  • No labels