GithubHelp home page GithubHelp logo

cmpt-479 / vbnconcolicgen Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 491 KB

Concolic Unit Test Generation for Java

Java 100.00%
concolic-testing java soot symbolic-execution testing unit-testing z3

vbnconcolicgen's Introduction

VBNConcolicGen: Java Automatic Unit Test Generation

Unit testing provides the foundation of the Testing pyramid in traditional approaches and requires a lot of resources to create and maintain the test suite. We aim to automate the process to save resources (and avoid tedious work) concolic execution.

Concolic execution (concrete + symbolic) has been used by Sen et al. to generate unit tests for both C and Java programs through CUTE and jCUTE respectively. Those libraries were written almost 20 years ago, with older dependencies. This project aims to recreate portions of the CUTE library using dependencies and versions of Java. This project recreation will be substituting Sen et al.โ€™s jCUTE usage of JDK 1.4 with JDK 11, and will use Z3 as the SMT solver, offered by Microsoft Research, rather than lp_solve.

The project implements Java unit test generation capabilities by performing basic instrumentation on Java code, running the instrumented program multiple times, and generating solved inputs such that every branch of a Java program is explored. The project uses Soot to instrument the code, and the Z3 SMT solver to solve constraints that allow us to re-execute programs and reach alternative branches.

More information about VBNConcolicGen can be found in the final report: CMPT 479 - Final Report.

This project was created as a final project for CMPT 479/745 (Special Topics in Software Engineering) at Simon Fraser University, supervised by Dr. Nick Sumner.

Components

  • Instrumentation
  • Runtime Library
  • Concolic Runner
  • Constraint Solver

Dependencies

  • Java 1.11
  • Maven
  • JUnit
  • Z3
  • Soot

Contributors

vbnconcolicgen's People

Stargazers

 avatar

Watchers

 avatar  avatar

vbnconcolicgen's Issues

Error arises with Float values when running the instrumented program

`//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package vbn.examples;

import java.io.PrintStream;
import vbn.Call;

public class Test_10_If_Float {
static float x;

public Test_10_If_Float() {
}

public static void main(String[] var0) {
    try {
        Call.init();
        Call.popArg("r0", var0);
        Call.pushSym("r0[0]", var0[0]);
        String var4;
        String var10000 = var4 = var0[0];
        Call.finalizeStore("$r1", var4, 7);
        float var5 = Float.parseFloat(var10000);
        Call.popArg("$f0", var5);
        Call.finalizeReturn("$f0", var5, 7);
        Call.pushSym("$f0", var5);
        x = var5;
        Call.finalizeStore("vbn.examples.Test_10_If_Float.x", x, 7);
        Call.pushSym("vbn.examples.Test_10_If_Float.x", x);
        float var10 = x;
        Float var6 = var10;
        Call.finalizeStore("$f1", var6, 8);
        double var1 = (double)var10;
        Call.finalizeStore("$d0", var1, 8);
        Call.pushSym("$d0", var1);
        Call.pushConstant(0.1);
        Call.apply(" cmpl ");
        double var13;
        int var11 = (var13 = var1 - 0.1) == 0.0 ? 0 : (var13 < 0.0 ? -1 : 1);
        double var14;
        Byte var7 = Byte.valueOf((byte)((var14 = var1 - 0.1) == 0.0 ? 0 : (var14 < 0.0 ? -1 : 1)));
        Call.finalizeStore("$b0", var7, 8);
        int var8 = var11;
        Call.finalizeStore("$i1", var8, 39);
        Call.pushSym("$i1", var8);
        Call.pushConstant(0);
        Call.apply(" <= ");
        if (var8 > 0) {
            Call.pushFalseBranch(8);
        } else {
            Call.pushTrueBranch(8);
        }

        Call.finalizeIf(8);
        PrintStream var9;
        PrintStream var12;
        if (var8 > 0) {
            Call.pushSym("java.lang.System.out", System.out);
            var12 = var9 = System.out;
            Call.finalizeStore("$r3", var9, 9);
            var12.println("Less than 0.1");
        } else {
            Call.pushSym("java.lang.System.out", System.out);
            var12 = var9 = System.out;
            Call.finalizeStore("$r2", var9, 11);
            var12.println("Greater than 0.1");
        }

        Call.terminatePath(13);
    } catch (Throwable var3) {
        Call.terminatedWithError(var3);
    }
}

}
`

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.