中图分类号 : TP311 文献标识码 : 文章编号 :
An Approach to Generate Integration Test Cases based on UML Collaboration Diagrams Linzhang Wang, Xuandong Li,Guoliang Zheng (CS Department , Nanjing University, Hankou Road 22 P.O. Box 419, 210093, Nanjing) Abstract: UML collaboration diagrams represent the structure relationship and interactive behavior of the objects involving in a collaboration of the software system, whether they are correctly implemented or not can be validated by integration testing. This paper propose an approach to generate integration test cases based on UML collaboration diagrams, take collaboration diagram as test model, from which we can extract information to generate integration test cases for testing the behavior. Firstly, the method identifies all the scenario paths in the diagram which represent use case realization by traverse the direct suclearcase/" target="_blank" >ccessors of each message. Then it selects and traverses each scenario path to get the method call sequence, path condition and parameters. Lastly, it applies category partition method to generate rational combination of input parameters, environmental conditions, as well as the corresponding output and method call sequence, to form a test case for each scenario path, thus we can test the interactive behavior of the software. This method completely base on UML, combine white-box and black-box test method to generate fewer test cases to test the gray-box behavior. In this paper, we apply this approach to an example of constructing sessions between cardholder and the bank through ATM, proving its feasibility and practicability, also propose a corresponding tool framework to facilitate its automation, thus to easily be deployed into the UML –based software development process. Keywords: test cases generation, integration testing, UML collaboration diagram, scenario path
1、引言 面向对象的技术因为能够解决传统程序设计语言的问题,自提出后,一度成为研究热点,事实上采用面向对象技术减少了不少错误的发生,对于提高软件质量起到了很大的作用,但是面向对象技术本身在任何情况下都不会排除软件测试的动机,同时面向对象语言的本质特征,如继承、封装、和多态等,也带来了新的故障风险,并给软件测试提出了新的挑战。[1,2,9] 区别于传统软件的功能分解,面向对象软件是通过合成来构造软件的,因而集成是面向对象软件开发中最重要的工作,面向对象软件构造过程中有的不同层次的集成,包括:从方法到类的集成,类通过继承集成,类通过容器集成,类到组件的集成,组件到应用系统的集成。在面向对象的迭代式增量开发过程中,通过不断的集成产生系统的可执行的版本,但每一个集成的环节都可能引入错误,导致软件中存在缺陷,为了能够发现软件集成中的问题,面向对象软件的