I7 Logo
Chair for Foundations of Software Reliability and Theoretical Computer Science
Informatik Logo TUM Logo
jMoped - A Test Environment for Java Programs

Overview

jMoped is a test environment for Java programs written as an Eclipse plug-in.

Given a Java method, jMoped can simulate the execution of the program for all possible arguments within a finite range and generate coverage information for these executions. Moreover, it checks for some common Java errors, i.e. assertion violations, null pointer exceptions, and array bound violations. When an error is found, jMoped finds out the arguments that lead to the error. A JUnit test case can also be automatically generated for further testing. Details are described in Felix Berger's diploma thesis.

Note: jMoped was first released as a text-based translator from Java bytecode into Remopla. For more information, see the translator page.


Screenshots Not Covered Partially Covered Covered Assertion Violation Heap Overflow NullPointerException ArrayIndexOutOfBoundException

See some examples in the screenshots.

Requirements

  • Linux/Unix system
  • Java SE 6
  • Eclipse 3.1 or later
  • JUnit 3.8.1

Download

Get the latest version of jMoped (including Moped) from our SVN server by:
    svn co "https://svn.model.in.tum.de/svn/Moped/trunk" Moped

Installation

The installation process is divided into two parts: Moped library and the Eclipse plug-in.
  1. Moped library
    • Set the environment variable JAVA_HOME to where Java is, e.g.
          export JAVA_HOME="/usr/java/jdk1.6.0_02"
      Set the following variables:
          export LDFLAGS="-L$JAVA_HOME/jre/lib/i386/client"
          export CPPFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
    • Go inside the Moped directory and call the configure script (assume that your Moped resides in $HOME). Note that the path given to the option prefix must be absolute.
          ./configure --prefix=$HOME/Moped
    • Build the library.
          make
    • Install the library.
          make install
    • Tell the plug-in where to find the library.
          export LD_LIBRARY_PATH="$HOME/Moped/lib"
      Make sure that Eclipse is started from an environment where this variable is set.
      Note: if you get UnsatisfiedLinkError when running jMoped, it is because Eclipse cannot find the library. Try starting Eclipse with the following option:
          eclipse -vmargs -Djava.library.path=$HOME/Moped/lib
      Alternatively, you can change the eclipse executable - the one you get by running "which eclipse" (it is indeed a script) - to include the library by default. Eclipse is indeed launched at the end of the script. You can then add $HOME/Moped/lib to java.library.path at this point. For example, in my case, I changed the line "-vmargs -Djava.library.path=/usr/lib/jni \" to "-vmargs -Djava.library.path=/usr/lib/jni:$HOME/Moped/lib \".
  2. Eclipse plug-in
    • Inside Eclipse, select Help -> Software Updates -> Find and Install....
    • Select the checkbox Search for new features and install and click the Next button.
    • Add the update site by clicking the button Show Remote Site... and enter the followings:
          Name: jMoped Plug-in
          URL:  http://www7.in.tum.de/tools/jmoped/1.0/update/
      
    • Select the site you just added and click the Next button. Follow the instructions and restart Eclipse afterwards.

Usage

After installing the plug-in, open the jMoped progress view by choosing Window -> Show View -> Other..., and then jMoped -> Progress View. Note that for the first time the progress view might be opened at the bottom part of Eclipse. It is recommended to move it to the left part of Eclipse (by drag-and-drop), where it is designed to be displayed. See the screenshots.

Note: jMoped contains some examples inside Moped/coverage/examples. You can create a new project in Eclipse by selecting File -> New -> Project.... Choose Java Project, and enter the directory in Create project from existing source on the next page. Some examples uses jMoped annotations, so you will need to include pds.jar into the classpath in order to compile them. See the FAQs page.

  • Open a Java program to be tested.
  • Choose the default bits of variables and the heap size in the progress view. The heap size can be at most 2^bits - 1.
  • To start the analysis, right-click on the method to be tested, and choose Run As -> jMoped Analysis.
  • jMoped will simulates the method with all possible parameter values within the given range. Markers will appear on the left of Java statements. Their meanings are:

    Not Covered Not covered
    Partially Covered Partially covered
    Covered Covered
    Assertion Violation Assertion Violation
    Heap Overflow Heap Overflow
    NullPointerException NullPointerException
    ArrayIndexOutOfBoundException ArrayIndexOutOfBoundException

  • Depending on the type of markers, there are some options available when clicking on it:
    • A JUnit test case can be created with an argument value that leads to the line where the marker is.
    • A call trace can be displayed in the plug-in view. It shows a sequence of method calls that leads to the line where the marker is.
    • A backward analysis can be performed (optionally with more bits) starting from an uncovered statement.

Documentations

See the poster at CAV'07, the FAQs page, and the thesis of Felix Berger.


Limitations

The current jMoped supports common Java features, however some obvious limitations are:
  1. No negative integer.
  2. No floating point.
  3. No multi-threading.
  4. Very limited support of String.
  5. Programs that use Java library might not work correctly, since they sometimes involve native library.

Changes

  • 29.06.07: Version 1.0.4 released.
  • 09.02.07: Some bugfixes, small changes in the interface.
  • 17.10.06: First public release.

Contact

jMoped was written by Dejvuth Suwimonteerabuth, Stefan Schwoon, and Felix Berger.


Links

This page has been outdated since 26.07.2007.