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