Use cases for Cover Reports
Diffblue Cover Reports shows a large range of information, with an intuitive navigation that helps organise it according to elements within the project, for example packages.
This page will describe some common scenarios and how Cover Reports can be used most effectively.
Assessing project risk
A team has several applications they maintain. They are thinking of taking responsibility for three more applications. Will the team be able to manage the extra work from the three applications?
Cover Reports shows how much risk each of the applications currently holds. This is seen in the Run Summary dashboards.
This project has a medium risk because 33.3% of the code is not covered by tests.
By knowing the risk of each application, a decision can be made whether to increase the total risk for the team or whether alternative action is required.
Finding how to reduce the risk
Risk levels are based on test coverage. The higher the coverage, the lower the risk.
If a team has a high risk application that is critical for the business, it is a good idea to reduce that risk by increasing test coverage.
Cover Reports helps pinpoint key areas of application code, which have low coverage. Therefore, teams can target their efforts which means reducing risk faster.
In the previous example an application has a high level of coverage (66.6%).
However, with 208 lines not covered, are there any classes which are critical to the operation and not covered?
With Cover Reports, this can easily be seen with this sunburst:
Here, you can see the
main(String) has 9 uncovered lines which accounts for 4.33% of the total. If this class is critical, it is worth tackling this first.
Another view into this is by tackling packages which hold key classes.
Improving your code base
Sometimes, our code is not as good as we would like. Knowing which code is untested can be the same as knowing which code is the most complex. But what makes it complex and what makes writing tests difficult?
Cover Reports helps answer these questions using the output codes tab.
This shows how Diffblue Cover was prevented from writing tests and how great an effect that had on the coverage.
Here, there are 8 issues to consider, where the left most has the largest effect.
Drilling down, the specific class methods can be found where these problems occurred, so those methods can be targeted for improvement.