节点文献

基于模型比较的软件测试用例生成方法研究

The Software Test Suite Generation Method Based on Model Compare

【作者】 谢晓东

【导师】 卢炎生;

【作者基本信息】 华中科技大学 , 计算机软件与理论, 2007, 博士

【摘要】 随着计算机应用范围不断扩大,关键领域的计算机应用越来越多。从而对软件质量和可靠性提出了更高的要求。作为软件质量和可靠性保证最重要的技术手段,软件测试在软件开发中的地位日益重要。软件工程相关技术的发展不断对软件测试技术研究提出了新的要求。软件工程技术对软件测试研究的影响表现在三个方面:软件开发过程模型决定了软件测试过程模型;软件体系结构决定了软件测试的层次划分;软件模型决定了软件测试用例生成方法。软件测试用例生成是软件测试的核心问题。选择较好的测试准则,从而提高测试用例集合的发现软件错误的效率具有重要意义。为比较不同测试准则之间的优劣,研究人员引入了分割测试方法,并使用至少发现一个错误的概率来判定测试准则的优劣。然而分割测试无法解释实践中采用等价类方法、路径覆盖等常用的测试用例生成方法的优势所在。事实上,这些常用测试方法优于随机测试以及其他的分割测试方法的原因是,这些方法表达了测试人员对被测软件的错误预期。在测试时这些方法对输入域的分割使得处于同一子域的输入之间的测试相关性较高,不同子域间的测试相关性较低。这使得所产生的测试用例在分布和检错效果上更接近于理想测试,从而能够提高测试效率。考虑到大多数软件错误可以归结为开发中需求与实现之间的差异,提出了基于模型比较的测试方法。该方法将软件需求和软件实现转换为用同一模型语言描述的模型,称从软件需求中得到的为需求模型,从软件实现中得到的为实现模型,用于描述它们的模型语言为基准模型。通过比较需求模型和实现模型,得到需求和实现之间的差异,并根据差异生成测试用例。采用不同的基准模型可以产生不同的基于模型比较的测试方法。在使用等价类作为基准模型的基于模型比较的测试方法中,需求模型需要测试人员手工生成。而实现模型可以通过符号执行技术,分析被测程序的源代码,得到各执行路径的路径约束和处理函数,然后将路径约束和处理函数转换成为等价类模型。比较需求模型和实现模型可以得到的差异模型,可以用于测试用例生成。在使用EFSM(扩展有限状态机,Extended Finite State Machine)模型作为基准模型的基于模型比较的测试方法中,通过将UML(统一建模语言,the Unified Model Language)模型状态图转换成为EFSM模型得到需求模型。而实现模型则需要先生成每一成员方法的每一执行路径的状态变迁对,然后生成类的状态集合以及状态变迁集合。状态集合以及状态变迁集合构成了原始状态图。得到原始状态图后,需要对原始状态图进行优化,以保证最后的实现模型是确定的、一致的。实验结果表明,基于等价类的基于模型比较的测试方法和基于EFSM的基于模型比较的测试方法都是可行的。与相应的软件测试用例生成方法相比,具有较高的测试效率。

【Abstract】 The score of the computer application is enlarging, and there are more and more computer applications used in key domain. Thus, higher software quality and reliability are required. As the most important technology to assure quality, software testing is more and more important in software development.With the development of relative technologies in software engineering, new requirements are emergying constantly to software testing; meanwhile, incur the improvement of software testing. The software engineering technologies affect software testing in three aspects. The development process models decide the process models of software testing. The software architectures affect the software testing levels. The software models, especially dynamic models determine the methods of test suite generation.The test suite generation is the key issue of software testing. It is important to select testing criteria in order to generate test suite more efficient. Partition testing is a kind of theory used to compare the efficiency of testing criterias. In addition, we use the probability of finding at least one fault to measure the effenciency. Thus, it cannot explain the adventage of some partition testing methods we used pervasively, such as equivalence testing and path-based testing methods. In fact, the adventage of the partition testing methods over random testing lies in that the partition testing methods can express the testers’anticipation of the errors in software under testing more exactly, and in that the partition testing methods partition the input domain into the subdomains of which the inputs are more relative. These make the distributeon and error-finding efficiency of the test suite very close to the ideal testing.Taking the adventage of partition testing into account, we present software testing method base on model compare. This method transforms the specification and the implementation into two models expressesd by the same model language, which we call base-model language. The model transformed from specification is specification-model. The other model transformed from implementation-model. We get the differentce between them, and then test suite is generated from this difference. The test suite generated by our method has much more test efficiency.With different base-model language, the testing method based on model compare is different.When using equivalence model as base-model, the specification-model should be created by tester manually, while the implementation-model can be created automatically——at first, we can get the path constrains and the calculation functions of each path of every member method through symbol execution technology and analyzing the originonal code of the software under testing, then we transform those path constrains and the calculate functions into an equivalence model.In the testing method using EFSM (Extended Finite State Machine) model as base-model, we create the specification-model by transforming the UML (the Unified Model Language) Statecharts into EFSM model. To create the implementation-model, we should get all path constrains and the calculate functions of methods from source code by symbol execution technology firstly, and then transform them into the set of states-transforming pairs, from which all possible state sets and the state transfer sets are generated.. These possible state sets and the state transfer sets is the original EFSM. Finally, optimizing the original EFSM to ensure the final implementation-model will be determinate and consistent.The experiment results show that software testing methods based on model compare are feasible, whether using equivalence model or EFSM model as base-model language. Moreover, these software testing methods are more efficient than other corresponding test suite generate methods.

节点文献中: 

本文链接的文献网络图示:

本文的引文网络