Computer Engineering and Applications ›› 2020, Vol. 56 ›› Issue (18): 238-246.DOI: 10.3778/j.issn.1002-8331.1907-0036

Previous Articles     Next Articles

Research on Automatic Generation of Function Call Path Test Case

SHEN Qing, MU Yongmin   

  1. College of Computer Science, Bejing Information Science and Technology University, Bejing 100101, China
  • Online:2020-09-15 Published:2020-09-10

函数调用路径测试用例自动生成的方法研究

沈晴,牟永敏   

  1. 北京信息科技大学 计算机学院,北京 100101

Abstract:

Automatic generation of test case is one of the most critical components in software test automation. Symbolic execution, as a program analysis method, is widely used because of its advantages of providing high coverage test case, but path explosion and constraint solving are very problematic. It greatly restricts the application of symbolic execution technology in real-time program analysis. The paper studies the granularity from statement to function, uses the abstract syntax tree and the bytecode sequence to extract the key information and control information of the function to get the function call relation model. The design algorithm generates the function call path (the function call path indicates the program from the beginning to the end). This method not only reduces the number of test paths to alleviate the path explosion problem, but also effectively solves the problem that the existence of function in the control condition makes the symbolic expression difficult to solve. The experimental results show that the method can optimize the test path set and reduce the number of test cases without reducing the coverage.

Key words: function call path, symbolic execution, global test case, test case automatic generation

摘要:

测试用例自动生成是软件测试自动化中最为关键的组成部分之一,符号执行作为一种程序分析方法,以其可提供高覆盖率测试用例的优势被广泛应用其中,但路径爆炸和约束求解问题很大程度制约了符号执行技术在现实程序分析中的应用。将研究粒度由语句提升至函数,利用抽象语法树和字节码序列提取到的函数关键信息和控制信息得到函数调用关系模型,设计算法生成函数调用路径(函数调用路径表示程序从开始到结束之间函数的调用或执行序列)。该方法不仅减少了测试路径数目缓解了路径爆炸问题,还有效解决了控制条件中存在函数导致符号表达式难求解的问题。实验结果表明该方法可优化测试路径集,在不降低覆盖率的前提下减少测试用例数量。

关键词: 函数调用路径, 符号执行, 全局测试用例, 测试用例自动生成