O'Reilly logo

Sonar Code Quality Testing Essentials by Charalampos Arapidis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Code coverage analysis

To better understand how Sonar works and to be in a position to better evaluate code coverage results, it is necessary to take a closer look at how code coverage tools analyze tests and calculate total coverage. The result of the coverage analysis process, although expressed as a single percentage number in Sonar, is based on many different coverage metrics.

Next, we will examine four fundamental coverage metrics used by all code coverage tools supported by Sonar:

  • Statement coverage
  • Branch coverage (also known as decision coverage)
  • Condition coverage
  • Path coverage

Statement coverage

Statement coverage is the most basic metric of the analysis process. It is the building block element for the rest of the metrics. The metric reports ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required