Generating test Cases using Randoop automation
1. Overview
Generating test Cases using Randoop automation
2. Operation
- Download the Randoop jar package;
- Put the jar package and the class you want to test (such as Calculate.class) in the same folder;
- Open a command-line prompt in this folder and enter the following command:
Java-ea-classpath.; randoop-2.1. 4. jar; Calculate randoop.main.Main gentests--testclass=calculate--timelimit=
The results are as follows:
Generated a lot of test case within that folder
3. Using Randoop's Eclipse plugin
- Download the plugin. I saw a randoop eclipse plugin on CSDN, and others said it would work, but I couldn't use it, and I knew why.
- Put the Randoop_0.1.0.201107281327.jar into the Plugins folder in Eclipse.
- Restart Eclipse, write a class, and run as---Create a new randoop configuration to find the class that will generate the test case
After running a lot of files, such as Randooptest***.java, running Randooptest.java in Java application, the Randoop automatically generated test cases are run successfully.
(the error in the figure is that the GC overhead limit exceeded error occurred after running Randooptest.java)
Generating test Cases using Randoop automation