Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: null

JaCoCo, the Java Code Coverage library, is an open source code coverage tool; the project's home website is JaCoCo Java Code Coverage Library

The Derby build tools support both the Emma tool and the JaCoCo tool.

Support for JaCoCo was added by DERBY-5817

Although some community members publish regular test results using the Emma tool, there are reasons to believe that the JaCoCo tool will be a superior tool in the future: see this mailing list thread

Setting up to run tests using JaCoCo is straightforward; here is what you do:

  • Download a current build of JaCoCo from the web site
  • place the two jar files jacocoant.jar and jacocoagent.jar in tools/java

To test your installation, run:

  • ant -Dderby.junit.testclass=org.apache.derbyTesting.functionTests.tests.lang.SimpleTest jacoco-junit-single

The primary code coverage Ant targets for working with JaCoCo are:

  • jacoco-junit: Runs all the Derby JUnit tests with JaCoCo to obtain code coverage
  • jacoco-junit-single: Runs the specified Derby JUnit test with JaCoCo to obtain code coverage.

There are some other JaCoCo Ant targets but you generally don't need to use them; you can read the build.xml file to learn more about them.

After you have run the chosen tests, look in the junit_YYYYMMDD_HHMM/coverage-report/index.html file to find the report of the code coverage analysis.

A Jenkins build job on builds.apache.org generates test coverage reports for trunk on a regular basis. The latest report can be found here.