EzUnit — Easing the Debugging of Unit Test Failures

Note: This page describes EzUnit Version 4, which is very different from the original version, EzUnit Version 1.

Purpose

to link JUnit test failures to locations in source code; to report logical errors analogously to compiler-generated errors and warnings

System requirements

Rationale

When the Eclipse compiler discovers an error (syntax error or semantic, i.e., typing, error), the IDE displays a description of the error (text associated with violated compiler rule) and the source location where it is assumed to have occured in the Problems View, allowing direct navigation to the (most likely) cause of the error. By contrast, when JUnit discovers a unit test failure (indicating a logical error in the program), it displays the name of the failed test case, leaving the task of localizing the cause of the failure to the programmer. EzUnit is a framework that offers an extension point for so called fault locators, methods to predict locations of logical errors in source code based on information gathered from the tested program and its test cases.

Usage

Given a Java project with JUnit tests that fail,

  1. right-click on test case, test suite, test package, or test project, and select "Run as > EzUnit Test" <in Analogie zu "JUnit Test", bitte ändernd>,
  2. wait until EzUnit has finished, and
  3. open one of EzUnit's available views to see, exploit, or manipulate the result.

Remark: If EzUnit shall be used with Windows 7, the Eclipse environment might possibly be run as admin to ensure its functionality.

EzUnit Result View

Potentially faulty source locations (methods) are displayed, ranked according to their computed likelihood of failure. By double-clicking on an entry, the corresponding source location is shown in the editor. <Was ist mit Location -1?> The results of each individual fault locator can be obtained by clicking the yellow (T) in the tab pane (right; see above).

EzUnit Fault Locator Management View

Not all present fault locators need be queried for fault localization, and not all queried fault locators need be given the same weight.

The Weigth column specifies the given linear weight of the fault locator relative to the others. <Wie bekomme ich die Properties?> Inactive fault locators are not considered. <Wie unterscheidet sich inactive von Weight = 0?> Note that certain fault locators are capable of computing their own, individual weight (based on the strength of the evidence they rely on), which is combined with the given weight.

EzUnit Call Graph View

The possible fault locations are usually restricted to methods called by one or more failed unit tests. To get a quick overview of all methods called by a test case, EzUnit provides an optional call graph view. It requires the prior installation of Zest (see Installation).

Each node has a tooltip showing some tracing information. Double clicking opens the corresponding method in the editor. <Was ist mit der Schachtelungstiefe?>

Constraining possible fault locations

To constrain the possible fault locations to code from selected sources, open the preferences/properties page:

<fehlt; hier sollte es auch möglich sein, Preferences mit Project-Properties zu überschreiben>

Marking possible fault locations in the editor

<fehlt, Marker sollten rot sein.>

Fault locators

EzUnit does not rely on a fixed set of fault locators — rather, it provides an extension point for including as many different fault locators as desired. The result of each activated fault locator is combined with that of the others to provide a joint error diagnosis.

EzUnit also provides an extension point for computing the minimum number of contained errors and the set of MUTs to which each error can be confined (called an error circle). <Each fault locator is then evaluated for each error circle separately.???>

Fault locators included with EzUnit

The following list of fault locator plugins is included with the standard update of EzUnit:

Adding new fault locators

New fault locators can be added by writing a new fault locator plugin for the extension point desribed here <eigene Seite> and copying it into Eclipse's plugin directory <reicht das?>.

Error circles

Currently, EzUnit ships with one plugin to compute error circles:

New pluigns to compute error circles can be added by implementing the extension point described <here>.

What EzUnit does behind the scenes

To collect information from test execution, EzUnit uses the open source Java profiler JIP. It is automatically installed when installing EzUnit.

EzUnit configures JIP to trace the execution of every test case (currently only the methods called) and to report the trace to the EzUnit plugin.

Installation

For the installation of EzUnit, use its update site http://www.fernuni-hagen.de/ps/prjs/EzUnit4/update/. The following updates are available from this site:

  1. EzUnit4 <bitte ändern>, the framework for running fault locators after a test run (includes fault locators listed above); includes a copy of JIP
  2. Zest, the plugin required for displaying the Call Graph View (an optional feature of EzUnit) <Sollte man hier nicht auf deren Update-Site verweisen? Oder wollen/müssen Sie die Version einfrieren? Ist das Anbieten einer eingenen Update-Site für andere Produkte OK?><Muß Zest wirklich zuerst installiert werden?><Übrigens: Ich kann Zest auch gar nicht auswählen, wenn ich http://www.fernuni-hagen.de/ps/prjs/EzUnit/update/ angebe!>
  3. <Ist diese Liste vollständig? Ist es überhaupt sinnvoll, hier zu unterscheiden? Was, wenn ein feature schon installiert ist? In einer anderen Version?>

Related work

Work on fault location is currently prospering. Tarantula is perhaps the best know fault locator tool. However, it is a standalone tool and currently available only for C source code.

Publications

Future work

Team