Test Code Coverage Tool Learning (Android Emma)

Source: Internet
Author: User

Blog Category:
    • Tool sharing
Eclipseeclemmaemmatestng

For the history of Eclemma and how to install it, please refer to http://www.ibm.com/developerworks/cn/java/j-lo-eclemma/index.html. The following is just how to use eclemma statistics in eclipse to use TENTNG Test Framework unit test coverage, which is based on the above article. My goal is to let you do not spend extra time to study how to configure the problem, if you follow my configuration in the statistical unit test coverage in the process of using exceptions or errors occur, please leave a message, the problem together to explore and grow together.




left mouse Click this button, appears




If you chose "Coverage configurations" for Emma's configuration,

1.test item configuration.

This main configuration is the test class you want to select.



2. Configuring Coverage items

This configuration is mainly you want to test the coverage of the class, here selected, here can only be configured to the package level (I think this is nearly enough, the following features, you will know why I said). Perhaps you see, I chose the Java file here (the first red box display) and the test original file (the second red box), if you also choose, then the coverage will check the two packages below the class. You know Emma could have tested the code coverage of Java application (did you see the article I recommended above?). )

3. Configuring the arguments parameter


4.classpath Configuration

The Jdbc.oracle jar package is configured here because the run coverage is not configured to cause errors that could not be found for the jar package. So I configured this one (the reason is still looking, because there is no such error when running the test program alone). According to this workaround, if you are unable to find the jar when running coverage, try specifying it manually here. If anything unusual please leave a message, solve together.


After this four-step configuration is basically complete, you may have a question to this step:

If I do not configure a test class coverage is to carry out such a complex configuration, you can not get dizzy, there is no place to do a general configuration it?

My answer is not know there is no, anyway, I studied the day did not find, later in the process in see can not inadvertently insert willow, if you first found, please message tell me, common improvement. This is not an estimate because this eclipse plugin solves the problem of duplicate configuration.

A: How to reduce duplicate configuration?



Right mouse button above this icon, appears below:



The second item in the interim is the meaning of replication, and after the copy is complete, you just have to select your test class.

B.code Coverage Results show

This article on the link above is described in the page. This is just to tell you how I use it, and it turns out that this piece of eclemma is doing well, and this is probably the real reason why it's so popular.

1. Select the Windows-->show view-->others input coverage on eclipse to appear:


2. Double-click Coverage appears:


3. Some buttons are introduced.

Button 2: That's the name you chose for the1.test configuration .

Button 1: Merge multiple "1.test configurations ", you know.

Button: 4: Quickly navigate to a class (this class is tired of opening your eclipse's workspace), as shown in



Button 4: The effect is as follows, the effect is the same as the double-click button 3.


Finally uploading this eclipse interface is the end result of this tool:


Specific also need pro-practice, there are problems to explore together, a variety of colors do not explain.

Test Code Coverage Tool Learning (Android Emma)

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.