计算机科学与探索 ›› 2011, Vol. 5 ›› Issue (7): 602-612.

• 学术研究 • 上一篇    下一篇

以偶然正确性概率为基础的测试充分度准则

陈 洁, 李 倩, 赵建华 , 李宣东   

  1. 南京大学 计算机科学与技术系, 南京 210093
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2011-07-01 发布日期:2011-07-01

Test Adequacy Criterion Based on Coincidental Correctness Probability

CHEN Jie, LI Qian, ZHAO Jianhua, LI Xuandong

  

  1. Department of Computer Science and Technology, Nanjing University, Nanjing 210093, China
  • Received:1900-01-01 Revised:1900-01-01 Online:2011-07-01 Published:2011-07-01

摘要: 提出了一种基于偶然正确性概率的测试充分度准则。考虑偶然正确性问题对测试的充分度衡量带来的影响, 设计了一种算法来计算程序中的一个错误因为偶然正确性的发生而使输出结果正确的概率。根据动静态数据流信息分析, 追溯了动态语句实例之间的定义-使用依赖关系, 并据此建立了定义-使用依赖关系图。对不同语句结构和跳转条件定义各种影响因子, 量化这些影响因子对错误的掩盖程度。给出了一种算法来计算程序的一次执行过程的测试充分度。选取五个C语言程序作为实验对象, 计算基于偶然正确性的测试充分度准则与错误发现效率之间的关系, 并与语句覆盖度的错误发现率进行了比较。实验结果显示基于偶然正确性的测试充分度准则能较好地发现错误。

关键词: 测试充分度准则, 偶然正确性, 动态数据流分析

Abstract: This paper proposes a new test adequacy criterion based on coincidental correctness probability. By considering the impact of coincidental correctness on the effectiveness of many test adequacy criteria, it designs an algorithm to calculate the probability that because of coincidental correctness, the output is still correct even when there is an error in the program. First, the use-definition dependence among statement instances is tracked in a program execution using control- and data- flow analysis, and the use-definition dependence graph is built based on the analysis result. Then the effect degrees of statement structure and transfer relationship on coincidental correctness probability are specified. Finally it gives an algorithm to get the test adequacy of the program in this execution. To evaluate the proposed approach, it conducts a mutation analysis on five simple C programs. Statement coverage cri-terion is compared with the new test adequacy criterion. The experimental results consistently approve the conjec-ture that using the coincidental correctness probability as testing adequacy criterion effectively quantizes the ability of a test suite to find errors.

Key words: test adequacy criterion, coincidental correctness, dynamic data-flow analysis