EMMA User Guide

A Step-by-Step Introduction to EMMA coverage toolkit


Table of Contents

1. Overview
2. Getting Started (command line)
2.1. Adding EMMA command line tools to your classpath
2.2. emmarun: instrumenting Java classes on-the-fly
2.3. Offline mode: separating instrumentation and execution
3. Getting Started (ANT)
3.1. Adding EMMA tasks to your ANT build
3.2. <emmajava>: instrumenting Java classes on-the-fly
3.3. Offline mode: separating instrumentation and execution

1. Overview

EMMA is a tool for measuring coverage of Java software. Such a tool is essential for detecting dead code and verifying which parts of your application are actually exercised by your test suite and interactive use.

EMMA's design strives for several, very elusive in their combination, goals:

  • report rich coverage analysis data without introducing significant overhead during either build or execution time

  • be useful in team development environments, while at the same time enabling fast individual develop-test cycle

  • support quick development and testing of small standalone Java applications as well as scale up to massive enterprise sotfware suites containing thousands of Java classes

EMMA differs from other coverage tools in its extreme orientation towards fast iterative develop-test style of writing software. JVM Profiler Interface (JVMPI)-based tools do not require an instrumented source build, but the runtime overhead of running with JVMPI on is empirically known to be very high and results in depressingly slow testsuite runs. For tools based on source code instrumentation, having to wait for a full source code rebuild just to check coverage metrics is not something a normal developer wants to do several times during a day. EMMA's goal is to be so unintrusive that frequent daily checking of coverage numbers becomes second nature to every developer on the team, if not a completely automatic byproduct of every test run.