Coverage Feature

Harness Test Coverage Data

Writing automatic tests is a central practice to increase code correctness. Knowing which part of the code is covered by automatic tests helps improving tests and consequently, it helps increasing code correctness.

JArchitect gathers code coverage data from Cobertura and JaCoCo. From this data, JArchitect infers some metrics on methods, types, packages and projects : PercentageCoverage, NbLinesOfCodeCovered, NbLinesOfCodeNotCovered.

These metrics can be used conjointly with others JArchitect features. For example you can know what code have been added or refactored since the last release and is not thoroughly covered by tests. You can write a CQLinq rule to continuously check that a set of classes is 100% covered. You can list which complex methods need more tests.

Another unique usage of code coverage data in JArchitect is viusalizing code coverage through the code metric view. See the metric view on the JArchitect code base:

  • Rectangle are methods of the code base.
  • Each rectangle area is proportional to the #lines of code of the method.
  • and the rectangle color is defined by the percentage coverage by tests of the method.

Coverage FAQ: