Giter Club home page Giter Club logo

test-io's Introduction

test-io

Obtain inputs (user-defined values in test cases that will affect the actual value in an assertion) and outputs (actual variable in assertions) of Junit4 test cases, with the help of trace collection library used in Microbat

Setup

The project uses trace-model and trace-diff as submodules. Run setup.bat script found in the root directory. It should generate a jar for usage as an external library in the ./target directory.

Usage

The method testio.TestIOFramework#getBuggyTestIOs should be used.
Your own microbat runner is required to generate traces.
4 InstrumentationResults (Wrapper for trace, and other results from microbat trace collection) are required. The non-buggy trace, buggy trace, non-buggy + buggy traces with org.junit.Assert included.
The non-buggy and buggy traces should be passed to trace-diff project's tracediff#getTraceAlignment method to generate a PairList to pass to test-io project.
Several other arguments are also required. In total, the required arguments are:

  • The 4 InstrumentationResults
  • PairList
  • Test case class and method name
  • Project roots to non-buggy and buggy traces

An example usage is provided in the TraceManger project (See tracemanager.TraceManager in https://github.com/bchenghi/trace-manager

How it works (Developers)

It first obtains the outputs to the test case. It utilises the trace with org.junit.Assert included, by checking if the trace node contains variable belonging to that class, and it takes the variable with the name indicating it is the output. (e.g. the variable name actual for assertEquals method) This is done for both non-buggy and buggy traces.
Using the PairList, the TraceNodes of the outputs from the 2 traces are compared, and paired.

It then uses microbat.model.Trace#findDataDependency method on the last outputs of the 2 traces repeatedly to find VarValues that are the inputs to the provided output.
Only takes variables read/written that are in the test method.
It checks if the data dependency is null, and adds to the inputs list if the read/written VarValue is in the test method.
Some values are written, but still has data dependencies. For such cases, it checks whether the variable is only written, and not read by the previous node.

The inputs are compared, and any missing input in the buggy trace from the non-buggy trace is added. This is because certain bugs can cause breaks in data dependencies, and some inputs cannot be captured just by using the buggy trace.

test-io's People

Contributors

bchenghi avatar

Watchers

 avatar

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.