When drilling down from the project dashboard, the resource viewer is the ultimate place to view detailed information on a given resource: file or unit tests file. The power of the tool comes from the fact that the resources can be viewed according to different axes of quality.
Viewing Source Code
When drilling down into measures, you will eventually reach the file level and will be able to browse the source code.
This tab displays source code with highlighted syntax.
To display the recently new/modified source code or view the last committers, you need to install the SCM Activity Plugin.
The Coverage tab displays the source code decorated with information about code coverage (by unit tests and/or integration tests).
In the source code:
- The first column displays the number of unit tests covering the line (available since Sonar 3.5, was the number of hits by unit tests in versions prior to 3.5)
- The second one displays the number of covered conditions by unit tests out of the total number of conditions to cover
The features described below are available since Sonar 3.5.
When the code coverage by integration tests is collected with the help of JaCoCo, all IT coverage measures are displayed on this tab:
A drop down list enables to filter the information to show on the viewer:
Image Removedclicking on a figure displayed in the first column, the unit tests covering this specific line are listed:
When selecting Per test > Covered lines in the second dropdown list, a third dropdown list appears. In this latter list, it is possible to select a specific unit test. Then, only lines covered by this unit test are displayed in the source code viewer: