Unit testing method and device

The invention discloses a unit testing method and device. The method comprises the steps that in the process of running an object code, whether an object statement is provided with an annotation identification or not is monitored; if not, the object statement loads a test code of the object code; th...

Full description

Saved in:
Bibliographic Details
Main Authors WANG MIN, LEI QINGLIANG, XIAO YINYIN
Format Patent
LanguageChinese
English
Published 17.11.2017
Subjects
Online AccessGet full text

Cover

Loading…
More Information
Summary:The invention discloses a unit testing method and device. The method comprises the steps that in the process of running an object code, whether an object statement is provided with an annotation identification or not is monitored; if not, the object statement loads a test code of the object code; the test code of the test code is run and loaded; if yes, the object code is directly run. According to the unit testing method and device, through the mode that the object statement is provided with the annotation identification or not provided with the annotation identification, automatic loading or deleting of the test code is achieved, and accordingly it is guaranteed that the object code cannot be influenced by the test code. 本发明公开了种单元测试方法和装置,方法包括:运行目标代码过程中,监测目标语句是否设置有注释标识;当确定所述目标语句未设置有所述注释标识时,利用所述目标语句加载所述目标代码的测试代码;运行加载有所述测试代码的目标代码;当确定所述目标语句设置有所述注释标识时,直接运行所述目标代码;由此可见,通过在目标语句设置或不设置注释标识的方式来实现测试代码自动加载或删除,这种方式保证了目标代码本身不会受到测试代码的影响。
Bibliography:Application Number: CN201710590804