6.3 Evaluation of the modified Algorithm
6.3.5 Validation of composite models
The strategy for validating the transformation algorithm is based on the premise that complex models can always be interpreted as combinations of models of lower complexity. The following sections demonstrate that higher models can be generated by combining the modelling patterns defined in the preceding section. In addition, it is shown that the algorithm presented in Section 4.5.3 also correctly converts complex models into valid test cases. The combination of atomic modelling patterns to complex models is based on substitutions, that replace individual activities within an activity diagram by a sub-model or vice versa a sub-model of an activity diagram by an activity of type UML CallBehaviorAction.
Basic Cycle
The cycle, which has already been identified by Staines, also belongs to the composite modelling patterns. The pattern structures the atomic modelling patterns disjunctive branching (Section 6.3.2) and disjunctive merge (Section 6.3.3) in such a way that a cycle arises in the control flow. The cycle can be realized as a while-do or do-while variant, with the difference of the direction of the control flows at the merge or branch nodes. Except the possibility, that a do-while structure can also be iterated zero times, the cycles structurally correspond to each other. However, the evaluation is a comparatively challenging task as the cycles must be executed multiple times, which means that the complexity of the generated test paths quickly increases to a level that can no longer be mastered by a human, especially for nested cycles.
The coverage criterion defined in section 2.2.1 requires that the algorithm for generating tests from UML activity diagrams generates execution paths, such that each cycle in the control flow is executed at least once. The validation of the algorithm therefore aims to demonstrate that it generates correct results (execution paths) for this requirement. Analogous to the validation of
Figure 6.16: Activity diagram and AG of an basic cycle
modelling pattern cycle (Figure 6.16). Here a variant of the activity diagram was deliberately chosen, in which an activity is in the front (node A1) and after the cycle (node A4). This activity diagram is used to show the correctness for different variations where the nodes A2 and A3 are
refined by other modelling patterns, in particular by further cycles.
The activity diagram shown in Figure 6.16 was used to validate the test case generation algo- rithm. For the coverage criterion concurrent activity path, two execution paths are expected from the activity diagram: one that evaluates the branch at node D so that the cycle is not traversed, and one that evaluates the branch so that the cycle is executed.
T C1 : I → A1 → M → A2 → D → A4 → F
T C2 : I → A1 → M → A2 → D → A3 → M → A2 → D → A4 → F
An inspection of the activity diagram shown in Figure 6.16 has confirmed that the algorithm generates correct execution paths in accordance to the concurrent activity path coverage cri- terion. The execution paths illustrated show that the algorithm has actually generated two execution paths for the activity diagram. Test Case T C2 represents the cycle initiated at node D, which returns the control flow via node A3 to node M, so that node A2 is executed several times. The result meets the requirement of the coverage criterion, which shows the correctness of the transformation for the base variant modelling pattern cycle.
The example of a cyclic activity diagram shown initially only covers the base case on which only a single activity is modeled. The aim of validation is to provide evidence that models of any complexity based on the pattern cycle are also transformed to test cases in conformity with the coverage criterion. Figure 6.17 shows the modified activity diagram. By refining node A3, the
Figure 6.17: Complex activity diagram and AG of a cycle with a sequence
original activity diagram in Figure 6.16 has been extended to a more complex model. The model has been extended by a sequence whose correct test case generation has already been shown. To still meet the coverage criterion, two execution paths must be created for this model, each representing an execution path with or without cycle execution. Furthermore, the execution paths generated from the model in Figure 6.17 may only differ at the point of the refinement of the model, i.e. specifically only at the path where the added sequence is modelled.
T C1 : I → A1 → M → A2 → D → A4 → F
T C2 : I → A1 → M → A2 → D → S1 → S2 → S3 → M → A2 → D → A4 → F
Ihe result is compliant with the coverage criterion, the algorithm has generated two execution paths, each representing a run with and without a cycle. Test case 2 shows that the node sequences S1, S2, S3 were also correctly placed and, compared to the simple cycle, the execution paths differ only in the area where the activity diagram was refined by inserting a sequence.
Nested Cyle
It has already been shown that the algorithm for simple cycles produces correct results. The atomic modelling patterns of disjunctive branching and disjunctive union can also be used in such a way that nested cycles are constructed. Figure 6.18 shows the activity diagram already
Figure 6.18: Complex activity diagram and AG of nested cycles
shown in Figure 6.16 again, but the nodes A2 and A3 have been refined with another instance of the activity diagram shown in Figure 6.16. Analogous to the procedure for validating the modelling pattern activity concurrency, the approach of refining the model to be validated with itself was also chosen here.
The algorithm for generating test cases was applied to this model and the results were subjected to a manual inspection. The generated execution paths are listed below:
T C1 : I → A1 → M → S4 → M 2 → S5 → D2 → S6 → D → A4 → F T C2 : I → A1 → M → S4 → M 2 → S5 → D2 → M 2 → S5 → D2 → S6 → D → A4 → F T C3 : I → A1 → M → S4 → M 2 → S5 → D2 → S6 → D → S1 → M 3 → S2 → D3 → S3 → M → S4 → M 2 → S5 → D2 → S6 → D → A4 → F T C4 : I → A1 → M → S4 → M 2 → S5 → D2 → S6 → D → S1 → M 3 → S2 → D3 → M 3 → S2 → D3 → S3 → M → S4 → M 2 → S5 → D2 → S6 → D → A4 → F
It can be seen that all cycles, also in combination with each other, are in conformity with the coverage criterion and thus covered by an execution path in the activity diagram, which supports the correctness of the test case generation in terms of the coverage criterion.
Figure 6.19: Complex activity diagram and AG with multiple nested cycles
To ensure that the test case generation algorithm generates correct results even for multiple nested cycles, another variant of the activity diagram shown in Figure 6.19 was created in a further validation step. Here the algorithm was applied two times with different depths, which allows to specify how often cycles are traversed.
Nested depth 1: T C1 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C2 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C3 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C4 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F Nested depth 2: T C1 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C2 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C3 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → M 3 → A4 → D3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C4 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C5 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → M 3 → A4 → D3 → A5 → D2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C5 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → M 2 → A3 → M 3 → A4 → D3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C6 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C7 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F
T C8 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C9 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C10 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C11 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F T C12 : I → A1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → M 1 → A2 → M 2 → A3 → M 3 → A4 → D3 → A5 → D2 → A6 → D1 → A7 → F
Especially the traversal with increased depth represents a special cognitive performance for a human tester, both in manual test case creation and in its execution. It contains the run-through of all cycles occurring in the model, if necessary in combination with each other. The tester must create the valid preconditions in each step, perform a number of test steps (i.e. enter test data, place the corresponding RFID tags in the reading field) and then check the postconditions. A comparison of the results with the activity diagrams depicted in Figure 6.19 shows that, the transformation algorithm is stable against nested embedding of cycles. In particular, all execution paths (double and triple nested cycles) that were generated are in accordance with the concurrent activity coverage criteria CACD.
Overlapping cycles
The atomic modelling patterns of disjunctive branching and disjunctive merge can also be linked together in such a way that overlapping cycles occur, shown in Figure 6.20. Here, a superficially simple model can quickly rise to a complex set of alternative execution paths through the modelled system, each of which must be addressed in an individual test.
In a similar procedure to the previous samples, the algorithm for generating test cases produces the following results:
T C1 : I → A1 → M 1 → A2 → M 2 → A3 → D1 → A4 → D2 → A7 → F
T C2 : I → A1 → M 1 → A2 → M 2 → A3 → D1 → M 1 → A2 → M 2 → A3 → D1 → A4 → D2 → A7 → F
T C3 : I → A1 → M 1 → A2 → M 2 → A3 → D1 → A4 → D2 → M 2 → A3 → D1 → A4 → D2 → A7 → F
By manual inspection it can be seen that the transformation algorithm generates correct results in terms of the coverage criterion for the model shown in Figure 6.20. This demonstrates that the algorithm is also correct for overlapping cycles.
Interlinked cycles
Another driver for complexity is based on the pattern interlinked or concatenated cycles. Figure 6.21 shows an example of of this pattern. In order to evaluate the algorithm it was also applied to this model.
Figure 6.21: Complex activity diagram and AG with interlinked cycles
Figure 6.21 shows a modification of the activity diagram already introduced in Figure 6.16. Specifically, the activity diagram depicted here is also a variant of the modelling pattern sequence (see Section 6.3.1 in Figure 6.11) of length two, were both activities have been refined by a cyclic structure.
The execution sequences generated from the activity diagram shown in Figure 6.21 are shown below. All three execution paths run through the activity diagram from the start node to the end node and all activities are represented by test cases in the modelled order. As required by the coverage criterion, all existing cycles in the model are run at least once and thus fulfil the CACD.
T C1 : I → A1 → M 1 → A2 → D1 → A3 → M 2 → A4 → D2 → A7 → F
T C3 : I → A1 → M 1 → A2 → D1 → A3 → M 2 → A4 → D2 → M 2 → A4 → D2 → A7 → F
6.3.6 Summary and Results
In the preceding sections, the identified atomic modelling patterns were combined to more complex modelling patterns. With the UML CallBehaviorAction modelling element, the UML meta model offers the possibility of coarsening partial models of UML activity diagrams or refining individual activities by partial models, whereby each non-atomic activity diagram can be reduced to a single activity on the discussed atomic modelling patterns.
Based on this feature of the UML meta model, the previous sections showed that the algorithm for systematic test case determination developed in this thesis also generates correct results for complex models in terms of the coverage criterion.
A validation for complex models by manual inspection of the generated test paths can usually only barley be performed because the complexity of the test cases quickly becomes unmanageable for humans. Therefore, the generation of test cases was exercised with models that were specifi- cally constructed in such a way that the resulting test cases are simplistic and allow conclusions to be drawn about the behaviour of the test case generation in more complex models.
In all cases, correct execution paths were generated from the activity diagrams according to the coverage criterion CCAD. Due to the traversal of the presented algorithm it is concluded that
the test case generation generates correct results even if models are further refined.