TestNG is a popular Java testing framework, Eclipse is a multi-language software development environment comprising an integrated development environment (IDE) and an extensible plug-in system. it is mostly we used Eclipse as IDE and TestNG as Unit testing framework. So that is helpful to use Eclipse plugin to help us analyze code coverage for TestNG unit tests. Here is some options:
- cobertura: Java code coverage analysis tool under Apache foundation, it can generate reports in both HTML or XML format. it can be invoked to execute from ant or command line.
- Clover: Clover is a very power and effective Java code coverage analysis tool, Clover not only gives you accurate and detailed code coverage, it gives you the information you need to assess the quality of that coverage, identify areas of poor quality coverage, and points you to existing tests when you need to add more. unfortunately it is commercial program.
- Eclemma: Best option for eclipse in case of TestNG, it is available under the Eclipse Public License, The overall size of thIS plug-ins is around 750 Kbyte. the following launch types are supported:
- Local Java application
- Eclipse/RCP application
- Equinox OSGi framework
- JUnit test
- TestNG test
- JUnit plug-in test
- JUnit RAP test
- SWTBot test
You can get more detail from http://www.eclemma.org/