摘要
分析了Java类测试工具Junit的功能和结构,并讨论了如何扩展Junit以满足一些Java类特殊要求的测试。Junit主要由3个包(framework、runner、textui)构成。通过对包中主要类的分析,阐述了每个包的作用。并最终以流程图的形式将3个包关联起来,以说明包之间的相互协作及测试在Junit中的执行过程。透过上述分析,可以了解测试在Junit中的执行原理。此外,针对Junit本身的不足和一些特殊的测试需要,总结出对Junit的部分扩展应用,并以实例进行说明。
Function and structure of java class testing tool Junit were analysed and, how to expand Junit to meet some special needs of java class testing is discussed. Junit is mainly made up of three packages (framework, runner, textui). By the mean of analyzing the main class in each package, functions of each package were instructed. Those three packages were connected in the form of flow diagram finally, in order to instruct the cooperation of packages and the process of test execution in Junit. By the mean of analyses above, the principle oftest execution in Junit could be understood. In addition, according to the deficiencies of Junit and some special needs of test, parts of extended applications of Junit are summarized, and instances were introduced to instruct them.
出处
《计算机工程与设计》
CSCD
北大核心
2005年第12期3413-3416,共4页
Computer Engineering and Design