摘要
针对自动化单元测试中面向路径的测试用例生成问题,通过改进传统的基于符号执行的测试用例生成方法,提出"符号化区间"来表示和分析变量的静态取值范围,并给出简单表达式和逻辑表达式中"区间可能集"和"区间必然集"的计算方法.提出了面向路径的值区间分析算法,通过对给定路径进行前向数据流分析来计算各条边上的区间上下文环境以及各符号的必然取值区间,在路径出口处的符号值区间必然集中任意取值,可得到覆盖给定路径的测试用例.与基于约束求解的传统方法相比,文中方法省去了表达式变换及调用约束求解器的过程,对输入变量弱关联的情况能够快速、准确地生成测试用例.
Aiming at path-oriented test generation in automatic unit testing, this paper improves the classic test generation method based on symbolic execution, proposes the symbolic interval to describe and analyze the range of variable value, and gives the computing method of possible interval set and necessary interval set of variable value in different condition expressions. Then, the paper designs a new path-oriented interval analysis algorithm using the forward data-flow analysis. Choosing value from the necessary interval set of symbolic variable on the path exit, the test case can be obtained. Compared to the classic method which is always dependent on constraint solver, this new method omits the steps of expression conversion and constraint solving, and it can generate test case appropriately and efficiently in case of the weakly relevant input.
出处
《计算机辅助设计与图形学学报》
EI
CSCD
北大核心
2013年第4期550-556,563,共8页
Journal of Computer-Aided Design & Computer Graphics
基金
国家自然科学基金(61202080)
国家"八六三"高技术研究发展计划(2012AA011201)
计算机体系结构国家重点实验室开放课题(CARCH201201)