Java code Coverage tools-emma and Jacoco

Source: Internet
Author: User


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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.