Project Home


How to use Coverlipse

This file is meant to give you a short introduction to the usage of Coverlipse. It is assumed that you know the basics about the usage of the Eclipse plattform, for example that you know where to find the project properties.

Running a JUnit test with Coverlipse

You'll need a class and a JUnit Test for the following steps. If you already have one, you may skip the next paragraph.

Setting up an example Project

If you don't have a JUnit Testcase right now, create a new Java project and download an example class and a TestCase for that class into your newly created project. The default package will do for this Howto (I'm not saying its good style!). You'll need to refresh your project and include JUnit in the classpath. The latter is done in the project properties. Include the $JUNIT_HOME variable to your classpath and edit the newly created entry such that it points to $JUNIT_HOME/junit.jar. See here for a screenshot of an approprietly configured project properties window.
Computation.java is not intented to do anything meaningful. Its just sample code.

Configuring a launch target for Coverlipse analysis

Now that you have a working JUnit Testcase, lets run a coverage analysis. For that, either use the launch shortcut or use the launch target dialog as follows:
In the run menu, select Run...

In the following dialog, create a new launch target in JUnit w/Coverlipse and choose your test case. Run the test.

If your Test Suite is large or your computer is slow, the test evaluation can take quite some time. Once the results are evaluated, the "Coverlipse Class View" will give you an overview over the tested classes. Double clicking a class there will open it in the editor and show the coverage analysis for that class.

General usage hints

  • With the buttons in the "Coverlipse Class View" toolbar the coverage criteria can be selected. You can switch between the criterias as you like after a test run.
  • If you view the results of an All-Uses Coverage Analysis and you see something like this:

    and wonder how that can be.
    This is not a bug. This is the typical case where the definition in line 59 was used only within the loop. It does not mean that the loop has not been exited. There is a new definition of a in line 61 and this definition is used on the method exit. If you feel the definition of line 59 should be used in line 63, you'll need a new test case that doesn't enter the loop.
Last updated 2009-02-14 18:32:09 by Matthias Kempka (coverlipse at mkempka.de)