Visualisations in Cover Reports
- Opportunities for Coverage Increase
- Coverage optimization
- Coverage over time
- How many lines are covered?
- Run Coverage Sources
- Output codes
Cover Reports has many visualisations that simplify analysis of coverage data generated by the
dcover CLI. Each visualisation is described in detail.
Opportunities for Coverage Increase
This is a sunburst chart which shows all elements in the project that have lines not covered by a test.
The rings represent the project hierarchy with the modules at the centre, then the packages, the classes and finally the methods on the outer ring.
Each ring is divided between the elements in the level. For instance, the methods ring will show all methods with uncovered lines.
The size of each segment indicates the proportion of uncovered lines within the level.
The number of uncovered lines is shown in the centre for the selected element in a ring. It is also shown as a percentage of the total of uncovered lines. Therefore, the methods will show the lowest proportions.
Filter the results
The elements shown in the sunburst can be reduced to allow fine-grained visibility. This is useful when the project is large and produces a chart that has a large number of segments. In this case the segments can appear very small. Anything that is less than 1% will show as a white segment, which is indistinguishable from the background.
To use the filter, type a term that you want to see the detail on in the Filter Text field and press the Apply Changes button that will appear.
The filter term is not case sensitive and can appear anywhere in the element name.
Here a filter has been applied for main:
Viewing different coverage runs
Only a single
dcover run is shown in the chart. To change the run, use the Select Run select list and then press the Apply Changes button.
The treemap shows coverage for the whole project, divided into sections of the appropriate size:
Use the toggle switches above the map to:
- Turn the colors on/off (the rectangles will recolor)
- Show the total lines of code (the rectangles will resize)
- Show the uncovered lines of code (the rectangles will resize).
Hover over the rectangles to see the name and coverage details. This is especially useful if some of the rectangles are smaller.
The visualisations shown are very similar for both the CLI and the plugin:
Total unique users per day:
Total number of write test operations per day:
Total tests produced per day:
This chart shows areas of your codebase where you can get the largest increases in coverage. It is particularly useful if you have added tests, or made the code more testable:
The example above is shown at the project level, but you can also view this at the package level (to see uncovered lines for all classes inside the selected package) or class level (to see uncovered lines for all methods inside the selected class). If there are multiple pages of information, you can use the arrows to navigate through the pages.
Coverage over time
These charts compare coverage over time for a class, package or a run, on the same branch. The example below shows a run coverage over time:
All runs are shown, but the current run is highlighted.
How many lines are covered?
These are stacked bar charts showing the lines covered for each element.
There are several types:
- Coverage by package: lines covered for each package in the project
- Coverage by class for the run: lines covered for each class in the project
- Coverage by method for the run: lines covered for each method in the project
- Coverage by class for the package: lines covered for each class in the package
- Coverage by method for the class: lines covered for each method in the class
Here is an example of the Coverage by class for the run chart:
Each chart shows how the lines in each element are covered. There are 4 line coverage types:
- Not covered
- Covered only by manual tests
- Covered only by Diffblue tests
- Covered by both manual and Diffblue tests
The sum of all the types is the total number of lines in the element.
When hovering over these charts, you can see the specific element that is affected as well as the amount of its lines that are covered. In the menu displayed in the top-right of the chart, you can also choose to view all coverage types, or only the coverage type that you have hovered over.
These charts can be zoomed to examine greater detail and each line coverage type can be enabled or disabled as required to aid analysis.
The following example shows only lines not covered and lines covered both by Diffblue and manually.
Run Coverage Sources
Run coverage sources is represented by a pie chart.
This pie chart is, by default, split into 6 sections which each represent how the code is covered by tests. These sections are:
- Covered by both Diffblue & manual tests
- Covered by Diffblue tests only
- Covered by manual tests only
- Not tested
The percentage displayed on the section of the pie chart represents the lines of code covered by that test source as a percentage of overall lines in the module.
The user can also hover over any section to get the raw amount of lines covered by that test source.
Here is an example of the Coverage sources pie chart where the “Not tested” section is hovered over:
Within this chart, the user can also click on a source within the legend to disable that section from the pie chart.
The remaining result would be a pie chart that represents how code is covered, as a percentage of total lines in the module minus lines covered by disabled sections.
For example, below is the same chart, but with the “Untestable” and “Trivial” sections disabled:
Cover runs, if there is a problem with a method that hinders test creation, an output code is provided. In these cases, methods can be left with uncovered lines.
This relationship is shown in several charts:
- Output codes with uncovered lines for the run
- Output codes with uncovered lines for the package
- Output codes with uncovered lines for the class
The colours of the items in the charts are arbitrary.
Here is an example of a chart showing the output codes for a run:
This shows that there are: