I have a test class which has a bunch of test cases.
I would like to measure the coverage of individual test case in the class.
Is there any way I could get a report which maps test case and the coverage.
I have a test class which has a bunch of test cases.
I would like to measure the coverage of individual test case in the class.
Is there any way I could get a report which maps test case and the coverage.
Have you tried Clover Clover
I know it's not free but it should give you what you need.
Our SD Java Test Coverage tool can give you this data.
This tool adds a special class TCV with methods to the program under test:
If the application calls the dump function, a test coverage vector is dumped to a file named with the current timestamp and the supplied BaseName.
You can use these to obtain test-specific vectors by modifying your test execution framework, whatever it is, just slightly. Where ever you invoke the Nth test case, add a call to dump:
This will produce a time stamped vector that covers just the code executed by the nTestCase.
Individual test case results can be found and displayed by the UI component of the tool. The UI component can also combine all those individual test case coverage results, into an overall test coverage result, to give a traditional "everything executed by all test cases" result. Or, you can compare test case coverage results to see which test cases cover the same code, to help eliminate redundant test cases, etc.
The UI component can also produce a report of lines covered by a test; this can be scripted, so one could produce a line-covered report for all test coverage vectors collected individually.