Jester - the JUnit test tester.

Copyright (2000-2005) Ivan Moore.

Jester finds code that is not covered by tests. Jester makes some change to your code, runs your tests, and if the tests pass Jester displays a message saying what it changed.

Jester includes a script for generating web pages that show the changes made that did not cause the tests to fail.

Jester is different than code coverage tools, because it can find code that is executed by the running of tests but not actually tested. However, Jester is not meant as a replacement for code coverage tools, merely as a complementary approach.

Jester is available only under the terms of the license agreement.

Jester has been tried on various operating systems, using Sun's JDK 1.4.1 and JUnit 3.8.1. There is absolutely no warranty whatsoever (see license agreement ); it might work on those or other platforms - see the Jester web page for latest known bugs, platforms that it has been tried on, FAQs, etc). Older versions of Jester might work with older versions of Java/JUnit (e.g. Jester < 1.30 for Java < 1.4).

Installation:

For File jester\functionaltests\NotTested.java: 1 mutations survived out of 1 changes. Score = 0
jester\functionaltests\NotTested.java - changed source on line 9 (char index=146) from 1 to 2
Anything() {
   //1
   return >>>1;
 }
}

For File jester\functionaltests\TestAll.java: 0 mutations survived out of 0 changes. Score = -1


For File jester\functionaltests\VeryTested.java: 0 mutations survived out of 1 changes. Score = 100


For File jester\functionaltests\VeryTestedTest.java: 0 mutations survived out of 1 changes. Score = 100


1 mutations survived out of 3 changes. Score = 67

took 0 minutes Jester has a progress window - the progress bar shows the proportion of source files that have been mutated; the text area shows the most recent mutation that has been made; the progress bar is green if the last mutation caused the tests to fail (i.e. good) and red if the tests still passed despite the mutation (i.e. bad). Note that the progress bar does not show progress while making different mutations to the same file - that is shown by text in the text area changing - because that was simpler to implement and the progress bar as it is gives a reasonably accurate indication of the amount of progress that has been made.

Usage:

Configuration options

For the following features, edit the file called "jester.cfg" from the installation directory and make sure it is on the classpath. For example, compilationCommand=javac refers to a line of text in the jester.cfg file.

Configurable mutations

The mutations that Jester applies to the source code are configurable, by editing the file "mutations.cfg" from the installation directory, which must be on the classpath. Each line of this file must have a format like:
%if(%if(true || where % can be any single character as a delimiter, and the text if( will be replaced by if(true ||. Note that this simple scheme of replacing text without parsing has proven adequate so far, but is likely to change in a future version of Jester.

Configurable Ignore List (e.g. for ignoring comments)

Jester can be made to ignore parts of every source file, by using the ignorelist.cfg file. This file contains lines starting with a delimiter character that specify regions of the source code to ignore; i.e. regions where it will not try to make a mutation. The first string is where to start ignoring the source and the second is where to stop ignoring the source. For example, to ignore comments in Java code, the ignorelist.cfg file would contain:
%/*%*/
%//%\n
(this is not entirely correct but is close enough; e.g. a string "http://jester.sf.net" up to the end of the line would not be considered for mutation by Jester using this ignorelist.cfg file, but that's not so bad.) (Note - these are included in the ignorelist.cfg file in the standard build).
This feature can be used by Pester too, e.g. to ignore python comments the ignorelist.cfg file would contain:
%#%\n
Note - the standard build also includes the line %//stopJesting%//resumeJesting so that you can easily tell Jester to ignore parts if a source file if it is causing problems for Jester. i.e. put a comment //stopJesting on the line before the code you want Jester to ignore and //resumeJesting on the line after the code you want Jester to ignore.

Using ANT

Here is a code snippet for using Jester from ANT. It copies the source file to a location where Jester can work - the tests are excluded for performance reasons. The classpath isn't specified statically but with the -cp parameter to Jester.
  <target name="jester" depends="">
    <delete dir="${modifiedsrc}"/>
    <copy todir="${modifiedsrc}">
      <fileset dir="${src}">
        <exclude name="**/*Test.java"/>
        <exclude name="**/AllTests.java"/>
      </fileset>
    </copy>
    <java classpath="${classpath}" classname="jester.TestTester">
      <arg value="-cp=${classpath}"/>
      <arg value="myproject.AllTests"/>
      <arg value="${modifiedsrc}/myproject"/>
    </java>
  </target>

If you get the source tree from CVS, you can try ant "run functionaltests" for an example of using ANT to run Jester. Have a look at Jester's build.xml to see how that works.

Known Problems:

If the code will not compile (either because of classes missing from the class path before Jester tried to compile any classes, or as a result of a change to a source file by Jester) then Jester might hang indefinitely.

This version of Jester will not run in VisualAge for Java (see Jester web page in case a new version exists that does run in VAJ).

NOTE that this version of Jester will not work with version 1.0 of Pester; a new version of Pester will be released that will work with this version of Jester - check the Jester web page if you want to see if there is a new version of Pester.

Jester can't seem to find it's config files when run from ANT - the default values usually mean that this isn't much of a problem though.

For Jester Developers:

If you want to look at Jester's java source code it is included in your "jester.zip" as a file called "source.jar". The source for the python code are the .py files. To run Jester's tests

Acknowledgements

Very many thanks to:

Support:

Please check the Jester web pages (hosted by sourceforge) for updates and the FAQs, and please enter comments or bug reports on the appropriate pages linked from there.

If it doesn't work

The file "jester.log" (in the directory where you ran jester) shows the commands that Jester has tried to run. In many cases, you can work out what is wrong by trying to run the last command that Jester tried to run. E.g. if the last line of the "jester.log" says "Sat Dec 01 21:46:36 PST 2001 Trying to run command "java jester.TestRunnerImpl jester.functionaltests.TestAll"", then try running "java jester.TestRunnerImpl jester.functionaltests.TestAll"; this may then reveal the problem. In the case of tests not passing (e.g. the message "Couldn't run test tester because tests didn't pass before any changes made"), try running the tests both directly (e.g. "java jester.functionaltests.TestAll") and using the command that Jester uses (e.g. "java jester.TestRunnerImpl jester.functionaltests.TestAll"). Please delete the file "jester.log" whenever it gets too large, or before running Jester if preferred.



version 1.37
jester@tadmad.co.uk