摘要
目前协议栈软件提供的定时器机制无法在单元测试中严格匹配程序实际运行的时序而导致单元测试不通过。文中针对这一现状进行了分析和研究,并提出一种单元测试中定时器自动回放的方法。该方法能够同时兼容Linux、Windows系统,且实现过程由C、Python共同完成。该方法在不影响协议栈软件实际运行的情况下,通过嵌入记录代码到运作态程序中,将定时器事件以通信消息的形式记录到测试用例数据包中,实现了单元测试中定时器消息的自动化验证,大大提高了单元测试的执行效率、精度和质量,对实现平台自动化单元测试具有重大意义。
At present,the timer mechanism provided by protocol stack software can not exactly match the actual running sequence of the program in unit testing,which results in the failure of unit testing.The present situation is analyzed and researched in this paper and a method of automatic replay of timer in unit testing is presented.This method is compatible with both Linux and Windows systems,and the implementation process is completed by C and Python.Under the circumstances that this method does not affect the actual operation of protocol stack software,embeds recording code into operating programs,records timer events as communication messages into test case packets,implements the automatic verification of timer messages in unit testing.It greatly improves the execution efficiency,accuracy and quality of unit testing and is of great significance to realize platform automation unit testing.
作者
吴卿蓉
华颖
WU Qing-rong;HUA Ying(Wuhan Research Institute of Post and Telecommunications,Wuhan 430074,China;FiberHome Telecommunication Technologies Co.,Ltd.,Wuhan 430074,China)
出处
《信息技术》
2020年第2期157-160,166,共5页
Information Technology