摘要
描述了一个Java自动化的单元测试工具JUTA.JUTA首先调用工具Soot解析单个Java方法的源码,并将源码解析成一个控制流图.在此基础上,采用符号执行的方法分析控制流图上的路径.工具能够自动地产生满足覆盖率标准的程序的测试用例.这种方法产生的所有测试用例都是可执行的,并且一般来说具有较小的测试用例数.如果用户能够合理地给出描述程序错误的断言,框架JUTA能够自动地检查源码中部分特定类型的错误.实验结果表明工具对Java单元代码的动态测试和静态测试均能在可接受的时间内给出有效的结果.
Testing is very important and time consuming in the development of high-quality software systems.This paper proposes an automatic testing tool JUTA for unit testing of Java programs.The approach is based on sharp analysis of the programs.JUTA firstly employs the Java optimization framework Soot to parse a single Java method into byte code and translates it into a control flow graph(CFG).It then performs depth-first or breadth-first search on the CFG to extract paths from it.Some techniques such as path length restriction are used to prevent path number explosion.Finally JUTA analyzes the paths based on the combination of symbolic execution and constraint solving.The goal of path analysis lies in two folds.It can generate a set of test cases satisfying the test criterion such as statement coverage.The test set typically has small number of test cases that are all executable.In addition to test generation for dynamic testing,it can also be used in static testing.JUTA can reveal certain kinds of errors from the source code automatically if the user provides proper assertions to describe the errors.The experimental results show that this tool is efficient for both dynamic and static testing.
出处
《计算机研究与发展》
EI
CSCD
北大核心
2010年第10期1840-1848,共9页
Journal of Computer Research and Development
基金
国家自然科学基金项目(60903049)
国家"八六三"高技术研究发展计划基金项目(2009AA01Z148
2009AA010313)
中国科学院知识创新工程领域前沿项目(ISCAS2009-DR01)~~