eToc - evolutionary Testing of classes

eToc implements a genetic algorithm for test case generation working on classes written in the Java programming language. A test suite is generated so as to maximize the level of branch coverage reached by the test cases. Assertions on the expected outputs must be added manually. The high level organization of the tool is depicted in the figure above.


The Java source code of the Class Under Test (CUT) is analyzed and transformed by the Branch instrumentor module, which produces an instrumented version of the original class and determines information about method signatures, call and control dependences, used by other modules. In particular, the Chromosome former is able to generate chromosomes based on the method signatures, and implements mutation operators to transform them.

The Test case generator evolves a population of chromosomes according to evolutionary rules. Chromosomes are obtained from the Chromosome former, which is also responsible for mutating them. The test case associated to each chromosome is executed using the instrumented version of the CUT, in order to determine the targets (branches) covered by each individual.

At the end of execution, the Test case generator minimizes the set of chromosomes while keeping the level of coverage reached by the genetic algorithm. Minimized test cases are converted into the format used by the tool Junit, that is, a Junit test class is generated. After manually adding assertions, test cases in the test class can be executed by means of Junit.


eToc is available as open source software. To download eToc click here.


More information about eToc and the principles behind its usage can be found in:

Paolo Tonella,
Evolutionary Testing of Classes
IRST Technical Report, Ref. No. P04-09-06. April 2004.