Test Template Framework

The Test Template Framework (TTF) is a model-based testing (MBT) framework proposed by Phil Stocks and David Carrington in (Stocks & Carrington 1996) for the purpose of software testing. Although the TTF was meant to be notation-independent, the original presentation was made using the Z formal notation. It is one of the few MBT frameworks approaching unit testing.

Introduction

The TTF is a specific proposal of model-based testing (MBT). It considers models to be Z specifications. Each operation within the specification is analyzed to derive or generate abstract test cases. This analysis consists of the following steps:

  1. Define the input space (IS) of each operation.
  2. Derive the valid input space (VIS) from the IS of each operation.
  3. Apply one or more testing tactics,[1] starting from each VIS, to build a testing tree for each operation. Testing trees are populated with nodes called test classes.
  4. Prune each of the resulting testing trees.
  5. Find one or more abstract test cases from each leaf in each testing tree.

One of the main advantages of the TTF is that all of these concepts are expressed in the same notation of the specification, i.e. the Z notation. Hence, the engineer has to know only one notation to perform the analysis down to the generation of abstract test cases.

Important concepts

In this section the main concepts defined by the TTF are described.

Input space

Let Op be a Z operation. Let x_{1} \dots x_{n} be all the input and (non-primed) state variables referenced in Op, and T_{1} \dots T_{n} their corresponding types. The Input Space (IS) of Op, written IS_{Op}, is the Z schema box defined by [x_{1}:T_{1} \dots x_{n}:T_{n}].

Valid input space

Let Op be a Z operation. Let \text{pre } Op be the precondition of Op. The Valid Input Space (VIS) of Op, written VIS_{Op}, is the Z schema box defined by [IS_{Op} | \text{pre } Op].

Test class

Let Op be a Z operation and let P be any predicate depending on one or more of the variables defined in VIS_{Op}. Then, the Z schema box [VIS_{Op} | P] is a test class of Op. Note that this schema is equivalent to [IS_{Op} | \text{pre } Op \land P]. This observation can be generalized by saying that if C_{Op} is a test class of Op, then the Z schema box defined by [C_{Op} | P] is also a test class of Op. According to this definition the VIS is also a test class.

If C_{Op} is a test class of Op, then the predicate P in C'_{Op} == [C_{Op} | P] is said to be the characteristic predicate of C'_{Op} or C'_{Op} is characterized by P.

Test classes are also called test objectives (Utting & Legeard 2007), test templates (Stocks & Carrington 1996) and test specifications.

Testing tactic

In the context of the TTF a testing tactic[1] is a means to partition any test class of any operation. However, some of the testing tactics used in practice actually do not always generate a partition of some test classes.

Some testing tactics originally proposed for the TTF are the following:


\begin{array}{l|l}
S = \emptyset, T = \emptyset & 
S \neq \emptyset, T \neq \emptyset, S \subset T \\
\hline
S = \emptyset, T \neq \emptyset & 
S \neq \emptyset, T \neq \emptyset, T \subset S \\
\hline
S \neq \emptyset, T = \emptyset &
S \neq \emptyset, T \neq \emptyset, T = S \\
\hline
S \neq \emptyset, T \neq \emptyset, S \cap T = \emptyset &
S \neq \emptyset, T \neq \emptyset, S \cap T \neq \emptyset, \lnot (S \subseteq T), \lnot (T \subseteq S), S \neq T
\end{array}

As can be noticed, standard partitions might change according to how much testing the engineer wants to perform.
  1. Two or more mathematical operators for which there are already defined standard partitions, or
  2. Mathematical operators which are defined in terms of other mathematical operators.
In any of these cases, the standard partitions of the operators appearing in the expression or in the definition of a complex one, are combined to produce a partition for the expression. If the tactic is applied to the second case, then the resulting partition can be considered as the standard partition for that operator. Stocks and Carrington in (Stocks & Carrington 1996) illustrate this situation with R \oplus G = (\text{dom } G \ntriangleleft R)\cup G, where \ntriangleleft means domain anti-restriction, by giving standard partitions for \ntriangleleft and \cup and propagating them to calculate a partition for \oplus.

Some other testing tactics that may also be used are the following:

Testing tree&

The application of a testing tactic to the VIS generates some test classes. If some of these test classes are further partitioned by applying one or more testing tactics, a new set of test classes is obtained. This process can continue by applying testing tactics to the test classes generated so far. Evidently, the result of this process can be drawn as a tree with the VIS as the root node, the test classes generated by the first testing tactic as its children, and so on. Furthermore, Stocks and Carrington in (Stocks & Carrington 1996) propose to use the Z notation to build the tree, as follows.


\begin{align}
VIS & == [IS | P]\\
TCL_{T_{1}}^{1} & == [VIS | P_{T_{1}}^{1}]\\
&\dots\\
TCL_{T_{1}}^{n} & == [VIS | P_{T_{1}}^{n}]\\
TCL_{T_{2}}^{1} & == [TCL_{T_{1}}^{i} | P_{T_{2}}^{1}]\\
&\dots\\
TCL_{T_{2}}^{m} & == [TCL_{T_{1}}^{i} | P_{T_{2}}^{m}]\\
&\dots\\
TCL_{T_{3}}^{1} & == [TCL_{T_{2}}^{j} | P_{T_{3}}^{1}]\\
&\dots\\
TCL_{T_{3}}^{k} & == [TCL_{T_{2}}^{j} | P_{T_{3}}^{k}]\\
&\dots\\
&\dots\\
&\dots
\end{align}

Pruning testing trees

In general a test class' predicate is a conjunction of two or more predicates. It is likely, then, that some test classes are empty because their predicates are contradictions. These test classes must be pruned from the testing tree because they represent impossible combinations of input values, i.e. no abstract test case can be derived out of them.

Abstract test case

An abstract test case is an element belonging to a test class. The TTF prescribes that abstract test cases should be derived only from the leaves of the testing tree. Abstract test cases can also be written as Z schema boxes. Let Op be some operation, let VIS_{Op} be the VIS of Op, let x_{1}:T_{1} \dots x_{n}:T_{n} be all the variables declared in VIS_{Op}, let C_{Op} be a (leaf) test class of the testing tree associated to Op, let P_{1} \dots P_{m} be the characteristic predicates of each test class from C_{Op} up to VIS_{Op} (by following the edges from child to parent), and let v_{1}:T_{1} \dots v_{n}:T_{n} be n constant values satisfying P_{1}  \land \dots \land P_{m}. Then, an abstract test case of C_{Op} is the Z schema box defined by [C_{Op} | x_{1} = v_{1} \land \dots \land x_{n} = v_{n}].

See also

References

Notes

  1. 1 2 Stocks and Carrington use the term testing strategies in (Stocks & Carrington 1996).
This article is issued from Wikipedia - version of the Monday, May 05, 2014. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.