首页 | 本学科首页   官方微博 | 高级检索  
     

c/c++单元测试底层模拟技术
引用本文:刘跃勇,王彤,罗静.c/c++单元测试底层模拟技术[J].计算机系统应用,2012,21(11):156-160.
作者姓名:刘跃勇  王彤  罗静
作者单位:[1]华南农业大学信息学院,广州510642 [2]广州凯乐软件技术有限公司,广州510630
摘    要:单元测试的目标是覆盖代码单元的功能逻辑,内部输入是单元测试的关键问题.目前大多采用打桩技术解决内部输入问题,但打桩会造成函数失真,而且难于解决底层函数不可控、难于初始化,静态输入,中断输入等内部输入问题.针对这些问题,提出了c/c++单元测试底层模拟技术,在测试用例中模拟、控制子函数的行为,使得底层函数产生的数据像参数一样可以在用例中设置,并且可以模拟局部数据和中断,解决了打桩难于实现的多种内部输入问题.

关 键 词:单元测试  内部输入  打桩  c/c++  底层模拟
收稿时间:2012/3/31 0:00:00
修稿时间:2012/5/15 0:00:00

Underlying Simulation for c/c++ Unit Testing
LIU Yue-Yong,WANG Tong and LUO Jing.Underlying Simulation for c/c++ Unit Testing[J].Computer Systems& Applications,2012,21(11):156-160.
Authors:LIU Yue-Yong  WANG Tong and LUO Jing
Affiliation:1 (School of Information, South China Agricultural University, Guangzhou 510642, China) 2(Guangzhou Kailesoft CO. Ltd, Guangzhou 510630, China)
Abstract:The goal of unit testing is to cover the functional logic of code unit, and internal inputs is the key of unit testing. Stub code has been used in most of the tools for c/c++ unit testing existed to solve the problem of internal inputs, while stub code may cause distortion of function, and it is difficult to solve these problems such as the uncontrollability and hard-initializing of underlying functions, the static inputs, the interrupt inputs, etc. To solve these problems, this paper proposed the underlying simulation technology for c/c++ unit testing, simulating and controlling the behavior of the sub-function in test cases, making the data generated by underlying function can be set in cases as the parameters, and it can simulate the local data and interrupt, avoid wasting time to write stub code, promote the testing efficiency.
Keywords:unit testing  internal input  stub code  c/c++  underlying simulation
本文献已被 维普 等数据库收录!
点击此处可从《计算机系统应用》浏览原始摘要信息
点击此处可从《计算机系统应用》下载全文
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号