To make JUnit results available in the code coverage results
view, configure a JUnit 4 with Enhanced Code Coverage test runner.
Procedure
- Enable code coverage on your project. Right-click
your project and select . Select Enable
code coverage. Click OK.
- Create a JUnit launch configuration. Right-click
the class that runs your tests. Select . Click New,
select JUnit, and click OK. The edit configuration
dialog opens.
- Set the test runner. In the Test
runner section of the edit configuration dialog, select JUnit
4 with Enhanced Code Coverage. Click OK.
Note: For the Test runner you
can also choose JUnit 3 or JUnit
4. In these cases, results will be displayed under Java
Code Coverage Workspace Results in the results view. With JUnit
3 and JUnit 4 you will only get
code coverage result for the whole test suite, not individual test
cases. With JUnit 4 with Enhanced Code Coverage you
will see results under JUnit Code Coverage Workspace Results for
each JUnit test case within a JUnit test suite.
- Run the JUnit.
- View the results. The results of the run are
available in the Code Coverage Results view. If you do not see this
view, select .