面向关键字流图的相似程序间测试用例的重用
作者:
作者单位:

作者简介:

钱忠胜(1977-),男,博士,教授,博士生导师,CCF专业会员,主要研究领域为智能化软件,软件自动化,智能推荐算法,人工智能,大数据与数据挖掘.
宋涛(1993-),男,硕士生,主要研究领域为软件自动化,软件测试与验证,程序分析与理解.

通讯作者:

钱忠胜,E-mail:changesme@163.com

中图分类号:

TP311

基金项目:

国家自然科学基金(61762041);江西省自然科学基金(20181BAB202009);江西省教育厅科技重点项目(GJJ180250)


Reuse of Test Cases Between Similar Programs Based on Keyword Flow Graph
Author:
Affiliation:

Fund Project:

National Natural Science Foundation of China (61762041); Jiangxi Provincial Natural Science Foundation of China (20181BAB202009); Key Project of Science and Technology of Jiangxi Provincial Department of Education of China (GJJ180250)

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    软件测试是软件开发中重要的一环,能有效地提高软件的可靠性和质量.而测试用例的重用可减少软件测试的工作量,提升测试的效率.提出一种面向关键字流图的相似程序间测试用例的重用方法,该方法将程序已经生成的测试数据重用到与之相似的程序中.可见,探究测试用例重用的前期工作是判定程序的相似性.对于程序相似性的判定,给出根据关键字流图相似性比较的方法:首先,将程序代码中的关键字存储在流图所对应的节点中,构建关键字流图;接下来,利用动态规划算法查找待测程序关键字流图的最大公共子图;最后,根据最大公共子图距离算法计算程序的相似度.较高相似程度的程序可用到测试用例重用的方法中.在利用遗传算法生成测试用例时,引用相似程序中适应度较高的测试用例,使种群在进行进化操作过程中不断与这些用例进行交叉,加快用例的生成效率.实验表明:将测试用例重用在相似程序的测试生成中,与传统方法相比,在覆盖率和平均进化代数等方面均有明显优势.

    Abstract:

    Software testing is an important part of software development, which can effectively improve software reliability and its quality. The reuse of test cases can improve the efficiency of testing and reduce the workload of software testing. Therefore, an approach to test case reuse between similar programs based on keyword flow graph is proposed. The method reuses test data generated by programs to their similar programs. Thus, the first step in exploring reuse of test cases is to determine similarities between programs. To determine the similarity of programs, a comparison method of similarity based on keyword flow graph is given. Firstly, the keywords in the program code are stored in the nodes corresponding to the flow graph to construct the keyword flow graph. Then, the maximum common sub-graph of keyword flow graph of the maximum programs tested is searched by using dynamic programming algorithm. Finally, the similarity of the programs is computed according to the common sub-graph distance algorithm. Programs with a high similarity can be used with test case reuse methods. In utilizing genetic algorithm to generate test cases, the test cases with high fitness of similar programs are selected. To speed up the efficiency of test case generation, the population intersects with these test cases continuously in the process of evolution. Experiments show that the reuse of test cases in test generation of similar programs has obvious advantages over traditional methods in terms of coverage and average evolution times.

    参考文献
    相似文献
    引证文献
引用本文

钱忠胜,宋涛.面向关键字流图的相似程序间测试用例的重用.软件学报,2021,32(9):2691-2712

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2019-01-03
  • 最后修改日期:2019-10-28
  • 录用日期:
  • 在线发布日期: 2021-09-15
  • 出版日期: 2021-09-06
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号