Code Coverage
The more popular tool is Emma and Jacoco,ecliplse Plug-ins have eclemma. Emma was used before the eclemma2.0, followed by Jacoco. This is mainly about Jacoco. Eclmama is very easy to use because it is an eclipse plugin, so you don't have to do much about it. Jacoco
Jacoco can be embedded in ant, Maven, or use Java Agent technology to monitor arbitrary Java programs, or you can use Java APIs to customize functionality.
The Jacoco monitors the calls in the JVM, generates the monitoring results (which are saved in the Jacoco.exec file by default), and then analyzes the results to match the source code generation coverage report. Note: Monitoring and analysis of these two steps, you must use the same class file, otherwise due to class different, and can not locate the specific method, resulting in coverage is 0%. Java Agent Embedding
First, you need to download the Jacocoagent.jar file and then add-javaagent:[yourpath/]jacocoagent.jar=[option1]=[value1],[option2]=[after the Java program startup parameter Value2], specific options can be found on this page. The default will be when the JVM shuts down (note that it cannot be kill-9), output the monitoring results to the Jacoco.exec file, or you can output the monitor report in real time via the socket (you can find a simple implementation in the example code). Java
You can use Ant, mvn, or Eclipse to parse jacoco.exec files, or you can analyze them through an API.