摘要
由于面向对象程序具有多态性等复杂特性,在软件单元测试中仅凭静态分析难以判断指针和引用指向对象的具体类型,为了解决这一问题,对类的抽象内存模型进行研究,并提出类的操作语义模拟算法;在路径分析时,通过构建和更新抽象内存模型,从而对变量所属类的范围进行限定;对于单元测试,对基于输入域的随机测试进行优化,提出基于路径的随机测试方法,得到输入变量的类型集合;实验表明,类的抽象内存模型结合操作语义模拟算法能够有效提取出路径中类相关的约束,基于路径的随机测试方法比起基于输入域的随机测试方法能够明显提高测试效率。
Due to the polymorphism and other complex characteristics of object-oriented programs,it is difficult to judge the specific types of objects pointed by pointers and references only by static analysis in software unit testing.In order to solve this problem,the abstract memory model of classes is studied,and an operation semantic simulation algorithm of classes is proposed.During path analysis,the class scope to which the variable belongs is limited by constructing and updating the abstract memory model.For unit testing,the random testing based on the input domain is optimized,and a path based random testing method is proposed to obtain the type set of input variables.Experiments show that the abstract memory model of classes combined with the operation semantic simulation algorithm can effectively extract the constraints related to classes in the path,and the path based on random test method can significantly improve the efficiency of testing compared with the input domain based on random test method.
作者
杜婉莹
王雅文
DU Wanying;WANG Yawen(State Key Laboratory of Networking and Switching Technology,Beijing University of Posts and Telecommunications,Beijing 100876,China)
出处
《计算机测量与控制》
2022年第2期84-94,共11页
Computer Measurement &Control
基金
国家自然科学基金项目(U1736110)。