一种针对单元测试框架的测试脚本重用方法
祁琳莹;洪玫;冯丽云;周宁;文婷婷
【期刊名称】《计算机应用研究》 【年(卷),期】2013(030)006
【摘要】With the wide application of unit testing framework in software industry,some problems have cropped up.One of the principal problems is how can guarantee the test code which developers accumulate not to be wasted,that is how to reuse the test code.This article proposed a solution to solve this problem-reuse the existing unit test code by translating the unit test code automatically.The specific steps was as follows:first,extracted the test case information from the existing unit testing
code;
then,recorded
the
information
in
XML
file;
finally,generated test code under the rules of new unit testing framework automatically with the technology of XSLT.In the end,this paper verified the feasibility of the method.%单元测试框架下的软件测试将产生大量的测试脚本,在软件测试过程中如何有效利用现有的测试脚本,实现软件测试脚本(代码)的重用成为业界关心的一个重要问题.业界最常见的复用需求是当开发项目更换新的测试框架时,如何重用开发人员在原单元测试框架下积累的测试脚本.针对这一问题,提出了基于测试脚本移植的重用方案.通过对单元测试脚本的分析和自动翻译方法,将原测试脚本中包含的信息提取出来,解析为基于XML的中间脚本,然后再利用XSLT技术,依据XML记录的信息,自动生成目标框架的单元测试脚本,从而解决单元测试脚本的重用问题.最后实验验证了方案的可