Skip to content

Determine the coverage of each test method using JUnit and JaCoCo.

License

Notifications You must be signed in to change notification settings

Evref-BL/AtomicCoverageAnalyzer-Java

Repository files navigation

Atomic Coverage Analyzer for Java

Determine the coverage of each test method with JUnit 4 and JaCoCo.
Run JUnit cases or suites, get a JaCoCo execution data file (.exec) for each test method.

Note

This is developed as part of the Modest project in order to optimize generated test suites.
However, it is applicable to any Java project.

Usage

The analyzer is both an executable and an agent.
It must be run with the -classpath option, and its value must contain the classpath of the project to be analyzed.
It takes as arguments:

  • outpath, path to an output directory where the exec files will be generated.
  • tests, list of fully qualified test case/suite names.
java \
  -javaagent:atomic-coverage-analyzer.jar \
  -classpath atomic-coverage-analyzer.jar:<classpath> \
  fr.evref.modest.AtomicCoverageAnalyzer \
  <outpath> <tests...>

Important

The classpath is needed to find the classes in the project to analyze. This means that the -jar option cannot be used to run this program. From the documentation:

When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored.

Build

Using Maven:

mvn clean install

The generated jar can be found in the target folder.

About

Determine the coverage of each test method using JUnit and JaCoCo.

Resources

License

Stars

Watchers

Forks

Languages