Article Preview
TopIntroduction
The fulfillment of requirement of the user is the major aim of software development. Improper specification and design leads to high cost in the implementation phase (Kuhn, 1999). Therefore, software systems are formally specified using any one of the specification languages, namely OCL, Z, B, VBM, alloy etc. In general, testing activity will be more effective when it is applied from the initial stages of software development. Furthermore, formal specification of the system serves both as an oracle and medium to generate functional test cases. Thus, there is a great demand for specification based testing in the field of formal specification based software development.
OCL has found its major application in precise software modeling (Cabot & Gogolla, 2012). However, the proposed approach extends the application of OCL in specification-based testing. Hence, the delayed fault and failure detection increases the cost of error correction and maintenance (Frank, Alla, Jürgen, & Robert, 2012). In this paper, SUT would mean the OCL specification of the system which is derived from its requirements specification. In the proposed approach, predicate-based mutation testing is performed. OCL- based testing is preferable due to the following reasons:
- •
OCL constraints can be easily derived from requirements specification of the SUT.
- •
OCL describes the model of a system precisely hence, OCL based functional test results will be accurate.
- •
Test scenarios can be designed effectively.
- •
Intermediate representation and concretization of OCL predicates require less effort.
- •
Metrics can be extracted easily from OCL expressions, so as to design the test paths.
In our approach, test scenarios are obtained by transforming OCL predicates into equivalent size abstracts for effective reasoning. Then, mutants are automatically generated for all methods of the SUT by applying fault classes (Tai, Vouk, Paradkar, & Lu, 1994), namely Boolean Operator Fault (BOOF), Incorrect Relational Operator Fault (IROF), Incorrect Parenthesis Fault (ICPF), Incorrect Boolean Variable Fault (IBVF), Incorrect Arithmetic Expression Fault (IAEF). In the proposed approach, test paths are generated based on Direct Class Coupling (DCC) metric (Bansiya & Davis, 1997) value which can be derived from OCL expressions of the SUT.
The proposed algorithm has used CSA algorithm to generate efficient test cases. In this paper, test adequacy criteria based on branch coverage and mutation score are used to evaluate the fitness functions. The following are the major merits of the proposed framework
- •
Defining fault classes for OCL predicates
- •
Structural refinement of OCL expression into simple predicates.
- •
Test path generation using DCC metric value.
- •
Efficient test data generation using CSA.
For the purpose of this work, the terms specifications, conditions, constraints and expressions are used interchangeably. On the same lines, specification-based testing would also mean mutation testing or fault-based testing. Similarly, component would mean class of the SUT.
The remainder of this paper starts with the related earlier works and elaborates the background of the proposed OCL specification-based testing. Then we discuss the proposed algorithm and present a proof of the proposed algorithm implementation. Prior to concluding, the proposed work is compared with the earlier work.
TopPrior studies show that there are various techniques available to generate test cases from OCL specification of the system.