摘要
白盒测试中经常用到覆盖率测试.轻量级覆盖率测试工具GCOV在使用上具有操作复杂繁琐的弊端.本文所述的设计基于GCOV覆盖率测试的原理,依据shell脚本批处理的特点将各部分操作封装为脚本工具;通过Expect脚本工具对上一操作是否成功进行断言,实现各脚本工具调用的联动.通过该设计进行覆盖率报告输出比传统的操作节省了大量时间.同时,本设计具有操作简易、便于移植的特点.极大的减少了工作人员重复的操作,提高了软件开发测试的效率.
Coverage testing is often used in white box testing. The lightweight coverage testing tool GCOV has the disadvantage of operating complicatedly. The design described in this paper is based on the principle of GCOV coverage testing. According to the characteristics of batch processing of shell script, all parts of the operation are encapsulated as script tools. Through the Expect script tool asserting whether the last operation is successful or not, to achieve all script tools being excuted automatically. The output of coverage report by this design saves a lot of time than traditional operation. At the same time, this design has advantages of operating simplely and transplanting easily. It greatly reduces the repeated operation of programmers and improves the efficiency of software development and testing.
引文
1李超,史晓华,王斐.一种轻量级的代码分支覆盖率检测方法:中国,CN106294163A.2017-01-04.
2张世伟.数据通信设备自动化测试框架设计与实现.[硕士学位论文].成都:电子科技大学,2017.
3姜文,刘立康.基于持续集成的C/C++软件覆盖率测试.计算机技术与发展,2018,28(3):37-41,46.[doi:10.3969/j.issn.1673-629X.2018.03.008]
4周雷.嵌入式代码覆盖率统计方法.计算机应用与软件,2014,31(5):326-327.[doi:10.3969/j.issn.1000-386x.2014.05.083]
5毛养红.自动化单元测试的测试用例扩展对桩代码的优化.当代教育实践与教学研究,2016,(5):212-213,211.[doi:10.3969/j.issn.2095-6711.2016.05.186]
6蒋云,赵佳宝.自动化测试脚本自动生成技术的研究.计算机技术与发展,2007,17(7):4-7.[doi:10.3969/j.issn.1673-629X.2007.07.002]
7凌永发,张云生,郭秀萍.软件测试自动化中的脚本技术.云南民族学院学报(自然科学版),2002,11(1):544-548.[doi:10.3969/j.issn.1672-8513.2002.01.006]
8李斌,陈榕.和欣编程环境中进行单元测试覆盖率分析的方法.福建电脑,2008,24(6):1-2,4.[doi:10.3969/j.issn.1673-2782.2008.06.001]