现代计算机(普及版)
現代計算機(普及版)
현대계산궤(보급판)
Modern Computer
2015年
11期
3-6
,共4页
测试用例生成%方法调用序列%模拟退火遗传算法%分支覆盖率
測試用例生成%方法調用序列%模擬退火遺傳算法%分支覆蓋率
측시용례생성%방법조용서렬%모의퇴화유전산법%분지복개솔
Test Case Generation%Method-Call Sequence%Simulated Annealing Genetic Algorithms%Branch Coverage
面向对象软件不同于传统的面向过程软件,其具有封装性、继承性和多态性。面向对象软件中类的方法中可能会调用其他类的对象,导致很难获取其他类的对象状态,并且由于其继承性和多态性,程序中可能存在多种执行路径,如果用传统方法生成测试用例,很难达到较高的测试覆盖率。针对这个问题,提出一种新的面向对象软件单元测试用例生成方法。这一方法基于改进的模拟退火遗传算法,使得优化过的测试序列可以覆盖到程序中更多的分支,生成的测试用例具有更高的覆盖率。通过实验验证方法的可行性,并与其他方法进行对比实验。实验结果证明该方法具有较高的分支覆盖率。
麵嚮對象軟件不同于傳統的麵嚮過程軟件,其具有封裝性、繼承性和多態性。麵嚮對象軟件中類的方法中可能會調用其他類的對象,導緻很難穫取其他類的對象狀態,併且由于其繼承性和多態性,程序中可能存在多種執行路徑,如果用傳統方法生成測試用例,很難達到較高的測試覆蓋率。針對這箇問題,提齣一種新的麵嚮對象軟件單元測試用例生成方法。這一方法基于改進的模擬退火遺傳算法,使得優化過的測試序列可以覆蓋到程序中更多的分支,生成的測試用例具有更高的覆蓋率。通過實驗驗證方法的可行性,併與其他方法進行對比實驗。實驗結果證明該方法具有較高的分支覆蓋率。
면향대상연건불동우전통적면향과정연건,기구유봉장성、계승성화다태성。면향대상연건중류적방법중가능회조용기타류적대상,도치흔난획취기타류적대상상태,병차유우기계승성화다태성,정서중가능존재다충집행로경,여과용전통방법생성측시용례,흔난체도교고적측시복개솔。침대저개문제,제출일충신적면향대상연건단원측시용례생성방법。저일방법기우개진적모의퇴화유전산법,사득우화과적측시서렬가이복개도정서중경다적분지,생성적측시용례구유경고적복개솔。통과실험험증방법적가행성,병여기타방법진행대비실험。실험결과증명해방법구유교고적분지복개솔。
Different from procedure-oriented software, object-oriented program has encapsulation, inheritance and polymorphism. The methods of classes in object-oriented program may call the objects of other classes. But it is too difficult to get the real objects state. And because of its inheritance and polymorphism, there may have a variety of program execution path. It is difficult to achieve satisfy the test coverage if it use the conventional method to generate the test cases. Aiming at this problem, proposes an approach of object-oriented program unit test case generation based on improved simulated annealing genetic algorithm. The test sequences optimized by simulated annealing ge-netic algorithm can cover more branches in the program, the generated test cases will have higher coverage. Finally, the feasibility of the method is verified by the experiments and compared with other methods. Experimental results show that the proposed approach has higher branch coverage.