Git Product home page Git Product logo

deepmutation's Introduction

DeepMutation

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.

Table of Contents

  1. Installation
    a. Requirements
    b. Setting up the environment
    c. Building
  2. Running
  3. How it works
  4. Credits
  5. Paper References

Installation

Requirements

  • 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]...

Setting up the environment

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.

Building

DeepMutation can be compiled into DeepMutation.jar with:

$ ant

Running

DeepMutation runs using a configuration file:

$ java -jar DeepMutation.jar config_file

An example is provided.

This will generate and test mutants.

How it works

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.

Overview of DeepMutation

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.

Credits

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.

Papers References

TODO ICSME + ICSE tool demo submission

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.