Unit Test-Code Coverage tool--Jacoco

Source: Internet
Author: User

Recently Learning MyBatis official documents, see the "Project Document" section has a lot of content has not seen, make a note, understand.

  With the popularity of Agile development, writing unit tests has become an industry consensus. But how to measure the quality of unit tests? Some managers one-sided pursuit of unit testing, resulting in the developers below the opportunistic, write a large number of repeated tests, the quantity up, the quality is still in place. It is a more feasible way to analyze the code coverage of unit tests compared to simply pursuing the number of unit tests. Jacoco (Java Code coverage) is a tool for analyzing unit test coverage, which, after running unit tests, gives you a clear picture of what parts of the code are measured by unit tests, what parts are not, and what percentage of the unit test coverage is given for the entire project. Eclemma is an Eclipse plugin based on Jacoco that developers can easily interact with. Therefore, this article starts from Eclemma, gives the reader an intuitive experience.

reference: Jacoco: A powerful tool for analyzing unit test coverage

  

I'm guessing this eclipse plugin logic is:        1. Each program file corresponds to a linear array, and the array length corresponds to the number of rows.    2. Then, similar to turn on debug mode, each row is executed, the corresponding row counter of the array plus 1.    3. Finally, the presentation of the results, divided into Eclipse and HTML version.            Color the counter size corresponding to each line of the program.

  

What are the application scenarios for this tool?

1. Test personnel performance assessment. The unit test code you write has good code coverage.

  

Unit Test-Code Coverage tool--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.