ecrash_testing Wiki
eCrash - Evolutionary Testing for Object-Oriented Software
Brought to you by:
afnog,
jcbribeiro
eCrash can be used from the command line. The list of available parameters is presented next. The support for other parameters is also under development.
You can download the current ecrash.jar from here.
Alert: The installation of the Java Development Kit (JDK) is mandatory; the JRE installation won't work. You can download it from here.
java [Java VM Options] ecrash.jar -testclass <class under test> [optional eCrash's parameters]
| Parameter | Required | Description | Default Value |
|---|---|---|---|
| testclass | yes | Full qualified name for the class under test. Usage: -testclass <fullqualifiedname> | No default value. |
| projectpath | no | Specify the directory for the project under test. Usage: -projectpath <fullpath> | The current directory. |
| bindir | no | Specify the relative path for the directory containing the binary code for the project. Usage: -bindir <binaryfoldername> | The default value is "bin" |
| libdir | no | Specify the list of relative paths for the directories containing dependencies for the project under test. The list is separated by ‘:’ in Unix systems and ‘;’ in Windows systems. | The default value is "lib". |
| testfoldername | no | Name of the directory to which the test cases should be written. If the folder already exists, then a new folder is created with the name format: <testfoldername> + #number. Usage: -testfoldername <testfoldername> | The default value is "testEcrash". |
| generations | no | Specifies the number of generations that the genetic algorithm will create. | The default value is 30. |
| population | no | Specifies the population size that the genetic algorithm will create. | The default value is 25. |
| seed | no | Specifies the seed used during the test data generation process (by default a new random seed is used when seed is not specified). | No default value. |
| notquit | no | When specified, the generation does not quits on run complete (ECJ Configuration) | No default value. |
| junit4 | no | When specified, the tests will be saved on the JUnit 4.x format. Otherwise, the JUnit 3.x is used. Usage: -junit4 | No default value. |
| verbosity | no | When specified, Outputs information about the test cases' generation. Usage: -verbosity | No default value. |
| help | no | Print the list of parameters. Usage: -help | No default value. |
| version | no | Print the version information. Usage: -version | No default value. |
| VM Argument | Required | Description |
|---|---|---|
| -XX:MaxPermSize | no, but you may need to specify it. | Size of the Permanent Generation. Usage: -XX:MaxPermSize=1024m |
| -XX:+UseGCOverheadLimit | no, but you may need to specify it. | Use a policy that limits the proportion of the VM's time that is spent in GC before an OutOfMemory error is thrown. |
| -Dsun.lang.ClassLoader.allowArraySyntax | yes (whenever the class under test deals with arrays) | This VM argument is required to avoid problems when loading classes with array syntax. For instance ClassLoader.loadClass() throws java.lang.ClassNotFoundException: [Ljava.lang.String; when the argument is not specified and you are dealing with arrays. In this particular case we were trying to load a array of String objects. Usage: -Dsun.lang.ClassLoader.allowArraySyntax=true |
| -XX:-UseSplitVerifier | no, but you may need to specify it | This may be required when you are using the JDK 7 and you are dealing with classes that are compatible with JDK <=1.6 . |
1 Download the Stack Project from here.
2 Extract the project
2 Place the ecrash's jar in the root folder.
3 Execute the following command:
java -XX:MaxPermSize=1024m -XX:-UseGCOverheadLimit -XX:+UseSplitVerifier -Dsun.lang.ClassLoader.allowArraySyntax=true ecrash.jar -testclass myjava.util.Stack -verbosity -seed 123 -generations 50 -testfoldername myUnitTests
This example creates unit tests for the public methods and constructors available in the class Stack, which is a container class available in the JDK.
Note: In order to avoid conflicts, the package for the Stack Project was renamed (myjava.util instead of java.util).