不可达路径是造成软件测试资源消耗的一个重要方面.在路径测试之前,检测程序中的不可达路径可以有效节约软件测试资源.提出了一种基于子路径扩展的不可达路径静态检测方法.该方法首先生成程序的子路径集,将路径的可达性问题转换为不等式组的求解问题.使用约束求解器判断子路径的可达性,可以分为:可达子路径,不可达子路径和无法判定三个部分,并对后面两部分的子路径扩展出的路径做二次可达性检测,最终获得程序中所有路径的可达性信息.可达性检测工作主要在子路径集上进行,因此有效地解决了路径爆炸问题.实验结果表明本文方法可以准确有效地检测出程序中的不可达路径.
Infeasible paths are one of the most important parts to cost the test resources.Before path testing,infeasible paths detecting in a program can save test resources efficiently. This paper presents a static method to detect infeasible paths which is based on sub-path expansion. First, the proposed method generates sub-path set, and the feasibility issues will be converted into inequalities. Second, the constraint solver is used to solve the inequalities, and then we can distinguish the sub-paths into three parts: one part is infeasible sub-paths, the second part is feasible sub-paths, and the third part is undetermined. The paths that are expanded from the latter two parts will be tested again to determine their feasibility. Eventually, the feasibility of all the paths is detected. Most of the detecting work is on sub-path set, so our method makes an effective solution to the path-explosion problem. Experimental resuits show that the proposed method can detect infeasible paths more accurately and effectively.