The invention relates to a method for obtaining statement and branch coverage rate when executing C25 assembly language, which relates to the field of software testing technology. According to the characteristics of C25 assembly program, the method selects the inserting pile algorithm and automatically inserts the pile for the program; when the program is running, the inserting point automatically records whether the pile point is running or not, and the number of times of operation. The running data of the inserted point can be used to analyze the operation of the program code between the two inserted points. Based on statistical analysis, statement coverage, branch coverage in statistics, records branch operation information, in order to avoid disrupting the function call records coverage information array of pointers in the call, the stack out of the stack of protection, avoid conditional jump branches using error index array.
【技术实现步骤摘要】
执行C25汇编语言时获取语句和分支覆盖率的方法
本专利技术涉及软件测试
,具体涉及一种执行C25汇编语言时获取语句和分支覆盖率的方法。
技术介绍
在软件测试过程中,获取语句和分支覆盖率有助于测试人员提高测试的充分性,对于未覆盖的代码以及分支,测试人员进行专项代码审查,可发现隐藏较深不易发现的问题。而现阶段缺少支持C25汇编语言的白盒测试工具,测试手段有限,因此需要针对C25汇编语言的特点,设计一种执行C25汇编语言时获取语句和分支覆盖率的方法。
技术实现思路
(一)要解决的技术问题本专利技术要解决的技术问题是:如何设计一种执行C25汇编语言时获取语句和分支覆盖率的方法,解决C25汇编语言程序缺乏白盒测试工具的问题。(二)技术方案为了解决上述技术问题,本专利技术提供了一种执行C25汇编语言时获取语句和分支覆盖率的方法,包括以下步骤:S1、对C25汇编程序进行自动插桩;S2、构建外围环境;S3、外围环境构建完成后,将插桩后的代码编译链接并执行,执行程序过程中采集插桩语句产生的覆盖率信息,自动生成代码覆盖率记录文件,在统计代码覆盖率的基础上,统计分支覆盖率。优选地,步 ...
【技术保护点】
一种执行C25汇编语言时获取语句和分支覆盖率的方法,其特征在于,包括以下步骤:S1、对C25汇编程序进行自动插桩;S2、构建外围环境;S3、外围环境构建完成后,将插桩后的代码编译链接并执行,执行程序过程中采集插桩语句产生的覆盖率信息,自动生成代码覆盖率记录文件,在统计代码覆盖率的基础上,统计分支覆盖率。
【技术特征摘要】
1.一种执行C25汇编语言时获取语句和分支覆盖率的方法,其特征在于,包括以下步骤:S1、对C25汇编程序进行自动插桩;S2、构建外围环境;S3、外围环境构建完成后,将插桩后的代码编译链接并执行,执行程序过程中采集插桩语句产生的覆盖率信息,自动生成代码覆盖率记录文件,在统计代码覆盖率的基础上,统计分支覆盖率。2.如权利要求1所述的方法,其特征在于,步骤S1中,在进行插桩时,按文件读取顺序进行插桩,并设置二维数组,记录插桩点的运行情况包括运行次数及是否覆盖情况,如果该插桩点运行,推断标号后的语句,至下一个插桩点之前的语句均运行过,如果该桩点未运行,则推断,标号后的语句至下一个插桩点之前的语句均未运行。3.如权利要求1所述的方法,其特征在于,步骤S...
【专利技术属性】
技术研发人员:杨波,李敏,李伟,
申请(专利权)人:北京计算机技术及应用研究所,
类型:发明
国别省市:北京,11
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。