Measuring Path Coverage

CoView is designed to measure path coverage from your JUnit tests in a few simple steps.

Step 1: Resolve your methods

If your JUnit tests were created using CoView, this step can be ignored.

As is often the case, a JUnit test can execute code from many methods. Since CoView abides by the thought that JUnit test cases should execute only one path in one method, each JUnit test needs to know before hand which method it is testing. CoView does this by letting you pick a method and then automatically adds a Javadoc.

To 'resolve' each JUnit test and select the method under test:

  • 1. Open up the JUnit Test Class in the CoView Editor
  • 2. Select the CoView Method Under Test decorator. CoView will attempt to identify the method under test.
  • 3. If the method under test is listed, select the appropriate one.
  • 4. If the method under test is not listed, then select 'Browse for Method Under Test'
  • 5. Enter the class under test and select from the method list.

Step 2: Run your tests

To get path coverage from your JUnit tests, you must run them through the CoView JUnit Runner. To do so:

  • 1. Open the CoView Perspective by selecting CoView > Open Perspective
  • 2. In the CoView Developer View, open the JUnit Test Case. Alternatively, through the Package Explorer, open the test case with the CoView Editor (right click on test case, select Open With > CoView Editor)
CoView JUnit Developer Vieww
  • 3. Select the Run in CoView JUnit Runner to run the JUnit test in the CoView JUnit Runner.
  • 4. The CoView JUnit Developer View will then be updated with path coverage.
CoView Developer View with Coverage