Questions tagged [emma]

EMMA is an open-source toolkit that measures and reports the percentage of Java code covered by unit tests.

EMMA features at a glance:

  • EMMA can instrument classes for coverage either offline (before they are loaded) or on the fly (using an instrumenting application classloader).
  • 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 together.
  • Starting with build 2.1.5320 it is possible to dump or reset coverage data remotely and without a JVM exit.
  • EMMA does not require access to the source code and degrades gracefully with decreasing amount of debug information available in the input classes.
  • EMMA can instrument individual .class files or entire .jars (in place, if desired). Efficient coverage subset filtering is possible, too.
  • Makefile and ANT build integration are supported on equal footing.
  • EMMA is quite fast: 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).

Useful Links:

274 questions
10 answers

Clearing coverage highlighting in Eclipse

After running coverage reports in Eclipse (using cobertura or an EMMA plugin), my source code files get highlighted in green, red and yellow depending on which lines of code were covered by tests. How can I clear this highlighting after I'm done?
  • 14,187
  • 12
  • 44
  • 66
7 answers

Testng, Emma, Cobertura, coverage and JDK 7 result in ClassFormatError and VerifyError

I have switched to the newest JDK 7 and I am having problems with running testng unit test on byte code that is fiddled by emma coverage tool. None of my test cases are run correctly and for most of them I am receiving such errors. …
  • 10,350
  • 9
  • 51
  • 93
3 answers

Emma coverage on Enum types

I'm running EclEmma, the Emma plugin for Eclipse, and the coverage report shows only partial coverage for an Enum I've defined, even though it shows the only value in the Enum as being covered. I'm assuming that there is a coverage gap for the…
Javid Jamae
  • 8,741
  • 4
  • 47
  • 62
3 answers

How do I generate Emma code coverage reports using Ant?

How do I setup an Ant task to generate Emma code coverage reports?
Rob Spieldenner
  • 1,697
  • 1
  • 16
  • 26
4 answers

Code coverage for Android

Possible Duplicate: Android test code coverage, Eclipse Its really frustrating to see there is no documentation for how to use EMMA for Android apps in Eclipse. Has anyone managed to work with EMMA in eclipse for Android apps? Without checking…
  • 371
  • 1
  • 5
  • 12
1 answer

Why emma doesn't give full coverage to finally blocks?

I don't get why emma doesn't give full code coverage to "finally" blocks. I've made a short example program to demonstrate this. When I execute the program it shows: try finally So I don't get why finally is marked as red (not executed) and the…
  • 83,644
  • 31
  • 142
  • 199
1 answer

eclemma - how to ignore source

I'm using junit/eclemma; it works great, except I'd like to instruct eclemma to ignore certain methods or classes. For example, how would i instruct eclemma to ignore getters/setters. Thanks in advance!
  • 7,406
  • 10
  • 63
  • 105
3 answers

Missing branches when using assertTrue instead of assertNull

In Java/Junit, I need to test for null with some object. There are a variety of ways I can test a condition but I have been using assertTrue for most of my tests. When I check for nulls in an assertTrue, EclEmma states that it is only testing one…
2 answers

How to force Emma code coverage report to ignore some methods?

Some methods, such as auto-generated getters, setters, equals and toString, are trivial for test. However, if they aren't added into the testing classes, the code coverage percentage (calculated using Emma) is reduced and may crash our system…
Felipe Arenales
  • 991
  • 1
  • 8
  • 19
6 answers

Java code coverage in Hudson

I'm migrating a couple of projects from an ant build to a maven one. The build server is , and will remain, Hudson. I've been having trouble recording code coverage in hudson with cobertura due to the tests run and recorded twice problem. The…
Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278
2 answers

Java 7 with emma and junit causing java.lang.VerifyError and Illegal local variable Errors

So I'm getting these errors [junit] Illegal local variable table length 17 in method [junit] java.lang.VerifyError: Expecting a stackmap frame at branch target 11 in method…
  • 4,012
  • 5
  • 38
  • 78
2 answers

Which emma-maven-plugin should I be using?

org.sonatype.maven.plugin:emma-maven-plugin:1.2 org.codehaus.mojo:emma-maven-plugin:1.0-alpha-3 org.apache.maven.plugins:maven-emma-plugin:0.5
  • 17,616
  • 8
  • 52
  • 80
5 answers

How do I get Emma or Cobertura, with Maven, to report coverage on source code in other modules?

I have a multi-module Maven setup with Java code. My unit tests, in one of the modules, exercise code in multiple modules. Naturally, the modules have inter-dependencies, and code in all relevant modules is compiled as needed in advance of test…
Joshua Fox
  • 18,704
  • 23
  • 87
  • 147
3 answers

Code coverage finally block

I have the following code construction: try { //some code } catch(CustomException custExc) { //log } catch(CustomException2 custExc2) { //log } catch(Exception exc) { //log } finally { //some code } I wrote unit tests: the first one…
Alexey Semenyuk
  • 3,263
  • 2
  • 32
  • 36
2 answers

Excluding Synthetic Classes in Emma within STS

When trying to run Coverage as or run a maven build using emma:emma I get the following: java.lang.IllegalStateException: Could not access method: Can not set static final [Z field packageName.ClassName.$jacocoData to [Z So I searched around…
  • 610
  • 4
  • 9
  • 19
2 3
18 19