Preliminary study on Jacoco

Source: Internet
Author: User

# background

Group code coverage platform because of network problems can not be used, only under their own research.

Coverage is a measure of the effectiveness of an automated use case, but only an auxiliary indicator, high coverage does not mean good quality, but low coverage can explain some problems,

# comparison

Comparison of coverage tools, direct reference material:

Blogs with great teams: https://tech.youzan.com/code-coverage/

# Understanding

1. In combination with the business form, the service cannot be stopped by the measured services;

2. Through the Javaagent way to start the Jacoco;

3. Javaagent mode can be used File,tcpserver, tcpclient three modes, commonly used is tcpserver format

4. After mounting the javagent, the ip:port can be used to interact with the javaagent, generate the Exec file and generate the report;

# detail

1. Jacoco Official website: https://www.eclemma.org/jacoco/up to download Agent.jar package;

2. Javaagent Format:

  -javaagent:[yourpath/]jacocoagent.jar=[option1]=[value1],[option2]=[ Value2]
More parameters: https://www.jacoco.org/jacoco/trunk/doc/agent.html

Practical Example:-javaagent:/home/tools/jacocoagent.jar=includes=*,output=tcpserver,address=xxx.xxx.xx.xx,port=6300,append =true

3. Generating the Exec file is not limited to ant tools, but the underlying is still accessed via TCP connection;

4. Generate exce after the need to parse into a report, more trouble, to have compiled class file also have to source. The most understanding of the state should be taken from the server back to the local operation;

5. Actual landing: The tested service Mount Javaagent--"Execute automation use case-" Generate exec file--"generated report (exec file generated on the tested server)

# questions

1. Jacoco only support the time period code coverage statistics, and can not be refined to which method/interface;

2. What is the difference between Javaagent's TCPServer and tcpclient? Flipping through documents is basically tcpserver, no tcpclient.

Preliminary study on Jacoco

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.