What is Emma ?

What is Emma ? 
Emma is an open source toolkit for measuring and reporting Java Code coverage. EMMA is distributed under the terms of Common Public License v1.0.
EMMA is not currently under active development; the last stable release took place in mid-2005. As replacement, JaCoCo was developed. EMMA works by wrapping each line of code and each condition with a flag, which is set when that line is executed.
Features
·         instrument classes for coverage either offline (before they are loaded) or on the fly (using an instrumenting application class loader).
·         Supported coverage types: class, method, line, basic block. EMMA can detect when a single source code line is covered only partially.
·         Coverage stats are aggregated at method, class, package, and "all classes" levels.
·         Output report types: plain text, HTML, XML. All report types support drill-down, to a user-controlled detail depth. The HTML report supports source code linking.
·         Output reports can highlight items with coverage levels below user-provided thresholds.
·         Coverage data obtained in different instrumentation or test runs can be merged.
·         it is possible to dump or reset coverage data remotely and without a JVM exit.
·         does not require access to the source code and degrades gracefully with decreasing amount of debug information available in the input classes.
·         can instrument individual .class files or entire. jars (in place, if desired). Efficient coverage subset filtering is possible, too.
·         Make file and ANT build integration are supported on equal footing.
·         The runtime overhead of added instrumentation is small (5–20%) and the bytecode instrumentor itself is very fast (mostly limited by file I/O speed). Memory overhead is a few hundred bytes per Java class.
·         EMMA is 100% pure Java, has no external library dependencies, and works in any Java 2 JVM (even 1.2.x).


EMMA-based tools

·         Intellij Idea Plugin—Includes code coverage support from its own and an EMMA plugin
·         SonarQube EMMA plugin—Enables usage of EMMA analyses within the code quality management platform SonarQube
·         Google CodePro AnalytiX
·         Jenkins Emma Plugin


Advantages

·         Branch Coverage
This additional metric will show coverage of all decision points in the program flow due to if and switch statements or theoperator. The result will be displayed directly in the Java editors similar to the JaCoCo reports using a new annotation icon in the left ruler. In addition, the Coverage view can be switched to branch counters. Also the Coverage property page will show branch figures for all Java elements. In addition, cycloramic complexity is shown in the view as well as on the property page. The former "block" counters will not be supported any more.

·         Faster Launching
Due the way how the JaCoCo coverage library works there will be no additional delay any more when applications under test are launched. This is a significant performance improvement especially for large applications and test suites.

·         Less Invasive
Certain launch types and test scenarios require so called in-place instrumentation in EclEmma 1.x. With this option the original class files get modified on disk and need to be restored with a clean build when switching back to another launch mode. Also JAR files were excluded from coverage analysis when in-place mode is activated. Without in-place instrumentation the class path of the application under test was modified which caused trouble for some applications.

With EclElmma 2.0 class files on disk will never be modified and the class path of an applications stays untouched. This will remove several hassles especially for Eclipse application launches and JUnit plug-in tests.

·         Intermediate and Remote Coverage Analysis
JaCoCo 2.0 (or more likely one of its subsequent versions) will support intermediate coverage dumps on applications running locally or remote without stopping the applications under test. This will also allow to reset the collected coverage information for a running application.

·         Flexible Analysis Scope
The scope of a coverage analysis can be modified at any time afterwards. While in EclEmma 1.x the scope needs to be specified on the coverage launch dialog before the application is launched, with EclEmma 2.0 the scope can be altered at any time when the result of the coverage session is viewed.

Disadvantages

·         Less visibility in reporting


Installing EclEMMA into Eclipse

In Eclipse, Help menu -à Install New Software -à Add Button
Name: EclEmma;
Location: http://update.eclemma.org.

Using EclEmma in Eclipse    
                                                                                        
 Running EclEMMA in Eclipse for the current project
                                                          
EclEmma - coverage

 
In Eclipse, Run menu ---> Coverage... and choose the package that contains the Test Cases that will be run for computing coverage

 From window Coverage (new Console) search the method from class FractionClass (see Figure 3) for which we compute the test coverage (using test cases based on source code)


Figure 3 Viewing the coverage using EclEmma  as html




Comments

Popular posts from this blog

Cross-site Request Forgery(CSRF) protection via Synchronizer Token Patterns and Double Submit Cookies Patterns

DAA SIMULATOR