Coder Social home page Coder Social logo

sofiaoreis / lithium-slicer Goto Github PK

View Code? Open in Web Editor NEW
11.0 4.0 2.0 13.88 MB

⚙️ Program slicer based on the Mozilla Lithium Tool for Java (also dubbed as Tandem-FL).

License: MIT License

Python 88.70% Shell 11.30%
slicer minimization defects4j java oracle

lithium-slicer's Introduction

The LithiumSlicer

LithiumSlicer (also dubbed as Tandem-FL) is a program slicer based on the Mozilla lithium tool, a test minimization tool to help developers create small test inputs (i.e., code snippets) in their bug reports.

The goal of LithiumSlicer is to minimize the program with respect to a certain criteria defined by the user. The user needs to provide an oracle that indicates what constitutes a good/bad minimization step. Although, the user can implement whatever oracle function she likes, in most cases the oracle checks if the output of the program is as expected. For the typical scenario, the oracle would check if the execution output of the minimized program matches with test message produced by the original test, e.g., "Expect 10 but seen 5". LithiumSlicer would remove as much code as possible such that test execution would still produce that same message.

Dependencies

Installation

  • Install dependencies above
  • $> pip3 install -r requirements.txt

Example Run

The script run_lithium is currently instantiated to the Defects4J (D4J) dataset. (Please send us a message if you need to generalize it.) The inputs to run_lithium.py are as follows:

  • The D4J project name
  • The D4J bug number
  • A test to use for minimization
  • A comma-separated list of input files to minimize
  • A string message to use as oracle

For example, the following command will minimize the file GrayPaintScale.java with respect to the test testGetPaint from D4J project Chart, bug number 24. We ran the test in isolation once to find the error message.

$> python3 run_lithium.py --project Chart --bug_number 24 \
 --test_case org.jfree.chart.renderer.junit.GrayPaintScaleTests::testGetPaint \
 --classes source/org/jfree/chart/renderer/GrayPaintScale.java \ 
 --expected_message "java.lang.IllegalArgumentException: Color parameter outside of expected range: Red Green Blue"

References

[1] Sofia Reis, Rui Abreu and Marcelo D’Amorim. 2019. Demystifying the Combination of Dynamic Slicing and Spectrum-based Fault Localization. International Joint Conference on Artificial Intelligence (IJCAI) · Conference Paper

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.