Aiming at some features in object-oriented software, such as classes, encapsulation, inheritance, dynamic connections, sequence diagram of UML design model is constrainted by OCL for testing interaction among classes. Transform _ SD-ToEG algorithm is proposed. A sequence diagram SD is converted to a graph called EG, short for execution Graph. In this algorithm, the new features alt, loop, opt, break four major combined fragments in UML2. 0 sequence diagram and nesting among them, the polymorphism problem is solved. In order to get the smallest complete test pathes. EG traversal strategy and Traver-seEG_ GenerateMinusTestPaths algorithm are presented. Finally, test scenarios are determined by testing pathes, and test cases are generated. Case analysis show that it can do software testing based on UML sequence diagram and OCL systematicly.%针对面向对象软件的类、封装、继承、动态连接等特性,对对象建模语言(UML模型)中的顺序图添加对象约束语言(OCL约束),做类间交互的软件测试.提出执行图EG生成算法,将顺序图SD转换为EG,解决UML2.0顺序图新增特性中的alt,loop,opt,break这4种常见组合片段及其嵌套和多态性问题;为得到最小完备的测试路径,提出EG的遍历策略和测试路径生成算法;确定测试场景,生成测试用例.经实例分析,它可以基于UML顺序图与OCL作系统地测试.
展开▼