Randoop is a unit test generator for Java. It automatically creates unit tests for your classes, in JUnit format. This fork is focused on the implementation and evaluation of the GRT paper. In particular, it aims to verify the coverage/mutation score and defect detection (via Defects4j) evaluation results from the paper.
The main repositories used to evaluate GRT are as follows:
- This repository: A fork of Randoop (with flags to enable GRT techniques)
- Coverage and Mutation Score: Evaluation of code coverage, branch coverage, and mutation score on 32 open source programs from the original GRT paper
- Defects4j: A fork of Defects4j, a dataset of known defects found in real open-source programs used in defect detection from the original GRT paper
Note that to contribute to this repository, on some platforms, you need to setup html5validator
and modify build. gradle
to actually run the command from the source path.
- Clone the repository
git clone git@github.com:randoop/grt-testing.git
cd grt-testing
- Follow the steps in
scripts/mutation-prerequisites.md
andscripts/mutation-repro.md
- You may need to copy the function definitions of
usejdk8
andusejdk11
directly intomutation.sh
ormutation-all.sh
- You may need to run the example command with a time limit:
./mutation.sh -vr -t <num_seconds> commons-lang3-3.0
- Instead of cloning the
randoop
repository and then removing it, you can instead copy from this fork of randoop.
- You may need to copy the function definitions of
usejdk11
cd <path_to_root_of_randoop-grt>
./gradlew shadowJar
mv -f build/libs/randoop-all-4.3.3.jar agent/replacecall/build/libs/replacecall-4.3.3.jar
<path_to_grt-testing>/scripts/build
usejdk8
- Clone the repository
git clone git@github.com:edward-qin/defects4j-grt.git
cd defects4j-grt
- Follow the steps to setup Defects4j
- Setup using
randoop-grt/scripts/defects4j_README.md
from here- Skip steps 3-5 (no need to run the scripts from this repository)
- Run
defects4j-grt/framework/test/test_run_tests.sh -p [Math|Lang|Chart|Time] -t [120|300|600]
- Output results will live in the
/tmp
directory
- Output results will live in the
agent
- subprojects for Java agents (load-time bytecode rewriting)gradle
- the Gradle wrapper directory (Should not be edited)lib
- jar files for local copies of libraries not available via Mavenscripts
- git hook scriptssrc
- source directories for Randoop, includingcoveredTest
- source for JUnit tests of the covered-class Java agentdistribution
- resource files for creating the distribution zip filedocs
- documentation, including the manual and resourcesjavadoc
- resource files for creating API documentationmain
- Randoop source codereplacecallTest
- source for JUnit tests of the replacecall Java agentsystemTest
- source for Randoop system teststest
- source for JUnit tests of RandooptestInput
- source for libraries used in Randoop testing
The source directories follow the conventions of the Gradle Java plugin, where each directory has a java subdirectory containing Java source, and, in some cases, a resources subdirectory containing other files.