Code Coverage

When writing unit test cases with TestNG the following questions will come.

1. Duplicating test cases

Manually we need to verify or we can use other metrics tools to see method usage to find what methods are used highly.

2. How many unit test cases are sufficient to cover all the code?

Use to see the code in color. Very nice tool

3. How to assure number of test cases?

We need t make sure that we are covering all types of error codes as part of testing.

Finally group them and run to see the overall performance and code coverage.


Group test cases in TestNG and run Emma coverage for given group. After that merge the sessions to get total code coverage by all the test cases. Check Merge Sessions


After some time started getting following error.

java.lang.ClassNotFoundException: com.vladium.emma.rt.RT

Copy emma.jar from eclipse to project lib folder and add to classpath. Issue resolved.