EclEmma - A Structural Code Coverage Tool
Code coverage analysis is a structural testing
technique (AKA glass box testing and white box testing), which tests a program’s
behavior against the intention of the examines how the program works (source
code), taking into account possible pitfalls in the structure and logic. Code
coverage analysis is the process of finding areas of a program not
exercised by a set of test cases, creating additional test cases to increase
coverage, and determining a quantitative measure of code coverage, which is an
indirect measure of quality.
EclEmma is a free Java code coverage
tool for Eclipse, available under the Eclipse Public License. It’s an Eclipse
plug-in that generates code coverage reports and provide simple trace
information about test cases. It launches from within the workbench like JUnit
test runs can directly be analyzed for code coverage.
For small programs, coverage is
relatively easy to calculate by hand; however, for larger programs, the task is
much more difficult. Coverage tools, like EclEmma, help by automating the
coverage process and providing readable reports.
Download and Configuration Details
Official site in this link (http://www.eclemma.org/)
Following steps are for installing
and configuring EclEmma on Eclipse IDE.
- Open Eclipse (any version of Eclipse)
- Go to Help -> Eclipse Marketplace
- Search “EclEmma” and click install on the result
Usage of Tool
EclEmma may be used on top of JUnit.
EclEmma runs the JUnit test cases and generates the coverage report from the
execution. EclEmma provides overall, package, and file level information on
statement.
Create a project containing a
package, a class and a method for (basic) demonstration. Create a JUnit class
for testing the aforementioned method, the test unit should contain methods
(@Test) to execute the unit. Then run the project by selecting “Coverage As”
and choose “JUnit Test”. Observe the report generated, from the “JUnit” and the
“Coverage” tabs.
Gives a very brief output on the console, yet allows for
multiple export formats for much more comprehensive viewing of the analysis of
the code base.
Coverage details from the Console in Eclipse IDE:
Coverage details:
Coverage details exported as HTML report:
Comments
Post a Comment