摘要
Gupta等提出一种线性化谓词函数的方法 (简称 Gupta方法 ) ,为指定程序路径自动生成测试数据 .该文给出了一种模型语言 ,研究静态、动态数据依赖关系的性质以及 Gupta方法中各概念的形式化定义 ,将 Gupta等提出的谓词片推广为路径静态切片 ,证明了路径静态切片构造算法的正确性 .对 Gupta方法的改进 ,省略了构造谓词片和输入依赖集的过程 ,改进后的方法构造线性约束的效率更高 .以改进后的方法为核心算法 ,开发了面向路径的测试数据自动生成的原型工具 ,并用实际的程序路径对该工具进行实验 .结果表明改进后的方法是比较有效的 .
Automatic generation of test data for a given path in a program is one of the primary problems in software testing, which can be described informally as: given a program P and a path W in P, let the input space of P be D, compute ②x② in D, such that when P executes on x, path W will be traversed. The difficulty of this problem lies in the fact that how to solve nonlinear constraint is unsolvable in theory. Gupta et al proposed a method, which is referred to as the Gupta Method in this paper, to address the above problem by linearizing the predicate functions with linear arithmetic representations. The Gupta Method has to analyze the static and dynamic data dependencies between the statements on W, and construct predicate slices and input dependency sets.This paper improves the Gupta Method by omitting the constructions of predicate slices and input dependency sets. Furthermore, when the divided differences are used to approximate to the derivatives that are coefficients in linear arithmetic representations, computing linear arithmetic representations is converted to compute predicate residuals completely, which needs to analyze neither static nor dynamic data dependencies between the statements on W. The improved method is more efficient to derive linear constraints.A model language is given to investigate the properties of static and dynamic data dependencies and define the notions in the Gupta Method formally. The predicate slices proposed by Gupta et al are generalized to path-wise static slices, and the soundness of whose construction algorithm is proved then. The soundness of the improvement is proved too.A prototype of path-wise test data generator has been developed, whose fundamental algorithm is the improved Gupta Method. The initial experiments carried out on this prototype with actual program paths have shown that the improved Gupta Method is practical and can be used to generate test data for not only both white-box testing and black-box testing but also assertion-oriented testing and regression testing.
出处
《计算机学报》
EI
CSCD
北大核心
2002年第12期1378-1386,共9页
Chinese Journal of Computers
基金
国家自然科学基金项目 ( 6 99730 5 1
90 10 40 0 7)
国家"八六三"高技术研究发展计划项目 ( 2 0 0 1AA1132 0 2 )
霍英东青年教师基金 ( 710 6 4)资助