Eclemma is a free, open source tool for detecting Java code coverage that can be easily installed in eclipse. Below I will briefly introduce the following plugin:
One Eclemma installation
In Eclipse, open: Help–>eclipse Marketplace
Search "Eclemma"
Finally, follow the prompts to install Eclemma and restart eclipse
two simple use of Eclemma
(1) using Eclemma to detect the code call situation:
i) look for a Java project, such as this:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/82/D3/wKioL1diEhCwTusSAAAs8oYe8E4479.png "title=" 20160526163832892.png "alt=" Wkiol1diehcwtussaaas8oye8e4479.png "/>
II) then right-click on the project or on a class, select Coverage As–>java application, and the final result is as follows:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/82/D4/wKiom1diERiBItYGAADfoaHhhX4813.png "title=" 20160526164920227.png "alt=" Wkiom1dieribitygaadfoahhhx4813.png "/>
Where the code representation of the green section has been executed, the yellow part indicates partial execution, and the red part indicates that no
(2) Use Eclemma to detect the coverage of code execution:
i) Select: Window–>show view–>other–>java–>coverage display Eclemma view
II) detect the invocation of the code as in the above steps, for example, I have detected the code invocation of the class "Testexternalizable" below, and then in the Coverage view you can see the following effect:
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/82/D4/wKiom1diEUuRvv8AAADmeM6PpFY265.png "title=" 20160526170503837.png "alt=" Wkiom1dieuurvv8aaadmem6ppfy265.png "/>
The Code coverage statistics for each class or package can be clearly seen
This article is from "Zifangsky's personal blog" blog, make sure to keep this source http://983836259.blog.51cto.com/7311475/1789806
Code coverage detection using the Eclemma plug-in in Java