Testing is one of the main and important activities in software development process and it is the main approach for evaluating the quality of generated software. Traditional and manual testing has some drawbacks, e.g., it is complex, time consuming, and error prone. Hence, test automation and optimal generation of test cases with high degree of fault detection and at the right time is very important. Model based testing is a new approach for software testing aiming at automatically generating test cases from the test model.
In this research, a new approach is presented for optimal generation of test cases using model based testing techniques. UML class diagram and UML state machine are used as test model. Constraints of the system are expressed on the test model using OCL. The OCL constrains are represented using class attributes. In addition, the class operations may have some pre- or post-conditions which are declared by OCL. These operations can be interpreted as the effect of the transitions of the UML state machine. In the proposed approach, using a forward and depth first search algorithm, and based upon some special criteria, the abstract paths on the state machine are selected. Then, using symbolic execution, the generated abstract path and the constraints on the path are converted into a mathematical representation in the AMPL language. Next, the generated mathematical model is solved with state of the art and powerful solvers that have interface with AMPL, and the test data is produced for each abstract test case. Finally, the generated test data will be transformed into executable test cases. The coverage criteria are used for conducting search algorithm, as well as the criteria for evaluating the quality of generated test cases. In order to increase the algorithm’s error detection power, the boundary value analysis will be used for generating boundary test data. Utilizing various solvers, the test cases are generated from several problems, e.g., linear, non-linear, decidable, and non-decidable problems, which are defined by OCL constraints in the test model.
Furthermore, a model to model transformation on UML state machine test model is presented. In this transformation, deep and shallow history pseudo states are transformed into choice pseudo states. With such transformation, one can hope that the test cases that are generated from the transformed model, cover more lines of code in source code of the test model. This will cause an increase in the error detection rate of the generated test cases from the transformed model, comparing to the error detection rate of generated test cases from the original model.
Papers in English