JAVA混合执行_Java的一个混合执行测试(concolic testing)引擎

CATG

CATG is a concolic unit testing engine for Java programs. The implementation uses ASM for instrumentation. ASM instrumentation instruments (see janala.instrument.) class files at runtime and dumps (see janala.logger.) to a file a log of all instructions executed by the program and all values loaded from local stacks and heaps. A concolic execution engine (see janala.interpreters.*) then takes the log and performs both symbolic and concrete interpretation of the logged instructions.

You must have java, gradle, cvc4 (http://cvc4.cs.nyu.edu/downloads/), and python 2.7 in your PATH. Two extra jar files are needed to run the tool. Create a lib directory in the root directory and download the following jar files

place them in the lib directory. Then invoke

gradle build

and

gradle integrationTest

To run the the full integration tests, use

./setup.sh # This builds CATG and copy it to lib/

python testall.py

To run tests and see coverage report, use

gradle build

gradle jacocoTestReport

This runs the tests using online concolic execution. To run tests with offline concolic execution, use

python --offline testall.py

If you want to generate tests on a Java class file having a main method, you need to use the concolic.py script. For example, the following command generates test inputs for the class tests.Testme (the java source of this class can be found in src/integration/java/tests/Testme.java.

python concolic.py --coverage 100 tests.Testme

Usage

python janala/concolic.py -h usage: concolic.py [-h] [--offline] [-v] [-c] [-D D] maxIterations className [arguments [arguments ...]]

positional arguments:

maxIterations Maximum number of times the program under test can be

executed.

className Java class to be tested.

arguments Arguments passed to the program under test.

optional arguments:

-h, --help show this help message and exit

--offline Perform concolic testing offline. An intermediate trace file

is generated during the execution of the program. offilne

mode results in 2X slowdown that non-offline mode

-v, --verbose Print commands that are executed.

-c, --coverage Compute detailed coverage by rerunning tests.

-D D JVM options

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值