Software testing is the most essential mean to ensure software correctness and improve software reliability. In order to minimize the time spent on software testing, a lot of researchers dedicate to the research of software testing methods and tools. As a standard modeling language, UML can be used to describe the structure and function of software systems. UML models not only contain the information involved in the process of demand analysis, but also provide the basis for the implementation of software systems. Therefore, the automatic generation of test cases based on UML models and its related testing techniques have important practical significance.Base on relevant theories and methods regarding models in software testing, this thesis investigates a UML state diagram based testing approach. Test cases satisfying some coverage criteria are obtained by traveling the state diagrams using the depth first search algorithm. Secondly, the program is converted into a control flow graph through the Soot tool. Thirdly, by traveling the control flow graph, we get the execution paths of procedures in the program. Fourthly, the matching between model paths and procedure paths is computed by means of the shortest edit distance algorithm. Further, an implementation approach to automatic execution of test cases is proposed. In this approach, the automatically generated test scripts is used to drive the stub program. Then we get the actual results of execution and complete the comparison of the results obtained. In addition, A software testing tool based on UML state diagrams is designed, whose design scheme and implementation are given in detail. |