DeepMutation is a mutation tool that learns how to generate mutants that are similar to real bugs.
At its core, DeepMutation relies on a Neural Machine Translation model that was trained to translate fixed code into buggy code. DeepMutation has learned from thousands of real world bug-fixes performed by developers, how to generate mutants that resemble real buggy code.
See Tufano, Michele, et al. "Learning how to mutate source code from bug-fixes." 2019 IEEE International Conference on Software Maintenance and Evolution (ICSME). IEEE, 2019.
- Installation
a. Requirements
b. Setting up the environment
c. Building - Running
- How it works
- Credits
- Paper References
- java 1.8
- python 3.4-3.6
- pip
- seq2seq
- tensorflow
For the study, we used versions:
- python 3.6
- seq2seq 0.1
- tensorflow 1.3
We also used defects4j for testing. We provide defects4j_checkout.py for easier checking out following a valid defects4j installation:
$ ./defects4j_checkout.py [-f] [proj_name]...
The recommended way to setup the environment is with venv:
$ python -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
We include the script check_env.sh for verification.
$ ./check_env.sh
Note: at the time of writing, a bug is present in seq2seq; this script provides the instructions for the related bugfix.
DeepMutation can be compiled into DeepMutation.jar with:
$ ant
DeepMutation runs using a configuration file:
$ java -jar DeepMutation.jar config_file
An example is provided.
This will generate and test mutants.
DeepMutation is a mutation infrastructure that allows to generate mutants that resemble real bugs. At its core, DeepMutation relies on a Neural Machine Translation model that learned from more than 700 thousands real bug-fixes mined on GitHub, how to translate fixed code into buggy code. Thus, the trained model is used to translate a method into a mutant.
DeepMutation starts by receiving the system to mutate and a configuration file. Next, the following modules are executed:
- The Extractor, extracts the raw methods from the system;
- The Abstractor, abstracts these raw methods into abstract methods, using the idioms specified in an input file. A mapping file to reconstruct the raw methods is stored.
- The Mutator invokes the NMT model to generate abstract mutants;
- The Translator uses the mapping file to translate abstract mutants in concrete mutants;
- Finally, the mutants are injected in the system, compiled and tested.
The infrastructure of DeepMutation was created by Jason Kimko (@jskimko) and Shiya Wang (@sywang15). The underlying model was created and trained by Michele Tufano and Cody Watson, based on seq2seq.
TODO ICSME + ICSE tool demo submission