UML已经成为建模语言的事实标准,如何从UML分析设计模型生成测试用例也为面向对象软件测试带来了新的挑战.为了从UML设计模型中的活动图直接生成测试用例,给出了UML活动图的形式化定义和灰盒测试方法.该方法首先分析UML活动图上的所有执行路径(每条路径称为一个测试场景),然后根据测试场景中的节点和转换所代表的活动及其输入/输出变量、相关约束条件等生成测试用例.并根据该方法实现了一个自动生成测试用例的工具UMLTGF,它可以从Rational Rose的规约文件中提取活动图信息并生成相应的测试用例.该工具能够提高软件测试的效率,降低测试成本.
Nowadays UML has been the de facto standard of software modeling languages, and it also brings a new challenge to software testing- How to do software testing based on UML design models. To generate test cases directly from UML activity diagrams, a formal definition of UML activity diagrams and a grey-box test method are proposed. The method first extracts each possible executing path named a test scenario from an UML activity diagram, then it gets input/output variables and relative constraints from the activity states and transitions in each test scenario to generate test cases. A test case generation tool based on this method named UMLTGF is also implemented, it can extract the information of UML activity diagrams from Rational Rose specification files and automatically generate test cases. The tool improves the process of test case generation and reduces the cost of test model creation.