Test Template Framework
   HOME

TheInfoList



OR:

The Test Template Framework (TTF) is a
model-based testing Model-based testing is an application of model-based design for designing and optionally also executing artifacts to perform software testing or system testing. Models can be used to represent the desired behavior of a system under test (SUT), ...
(MBT) framework proposed by Phil Stocks and David Carrington in 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 Model-based testing is an application of model-based design for designing and optionally also executing artifacts to perform software testing or system testing. Models can be used to represent the desired behavior of a system under test (SUT), ...
(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: # Define the ''input space'' (IS) of each operation. # Derive the ''valid input space'' (VIS) from the IS of each operation. # Apply one or more ''testing tactics'',Stocks and Carrington use the term ''testing strategies'' in . starting from each VIS, to build a ''testing tree'' for each operation. Testing trees are populated with nodes called ''test classes''. # ''Prune'' each of the resulting testing trees. # 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 Abstract may refer to: * Abstract (album), ''Abstract'' (album), 1962 album by Joe Harriott * Abstract of title a summary of the documents affecting title to parcel of land * Abstract (law), a summary of a legal document * Abstract (summary), in a ...
.


Important concepts

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


Input space

Let Op be a Z operation. Let x_ \dots x_ be all the input and (non-primed) state variables referenced in Op, and T_ \dots T_ their corresponding types. The ''Input Space'' (IS) of Op, written IS_, is the Z schema box defined by _:T_ \dots x_:T_/math>.


Valid input space

Let Op be a Z operation. Let \text Op be the precondition of Op. The ''Valid Input Space'' (VIS) of Op, written VIS_, is the Z schema box defined by \text Op/math>.


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_. Then, the Z schema box P/math> is a ''test class'' of Op. Note that this schema is equivalent to \text Op \land P/math>. This observation can be generalized by saying that if C_ is a test class of Op, then the Z schema box defined by P/math> is also a test class of Op. According to this definition the VIS is also a test class. If C_ is a test class of Op, then the predicate P in C'_

P/math> is said to be the ''characteristic'' predicate of C'_ or C'_ is ''characterized'' by P. Test classes are also called test objectives , test templates and test specifications.


Testing tactic

In the context of the TTF a '' testing tactic'' 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: * Disjunctive Normal Form (DNF). By applying this tactic the operation is written in Disjunctive Normal Form and the test class is divided in as many test classes as terms are in the resulting operation's predicate. The predicate added to each new test class is the precondition of one of the terms in the operation's predicate. * Standard Partitions (SP). This tactic uses a predefined partition of some mathematical operator . For example, the following is a good partition for expressions of the form S \spadesuit T where \spadesuit is one of \cup, \cap and \setminus (see Set theory). *: \begin 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 *:As can be noticed, standard partitions might change according to how much testing the engineer wants to perform. * Sub-domain Propagation (SDP). This tactic is applied to expressions containing: *# Two or more mathematical operators for which there are already defined standard partitions, or *# 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 illustrate this situation with R \oplus G = (\text 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. * Specification Mutation (SM). The first step of this tactic consists in generating a ''mutant'' of the Z operation. A mutant of a Z operation is similar in concept to a mutant of a program, i.e. it is a modified version of the operation. The modification is introduced by the engineer with the intention of uncovering an error in the implementation. The mutant should be the specification that the engineer guesses the programmer has implemented. Then, the engineer has to calculate the subset of the VIS that yields different results in both specifications. The predicate of this set is used to derive a new test class. Some other testing tactics that may also be used are the following: *
In Set Extension IN, In or in may refer to: Places * India (country code IN) * Indiana, United States (postal code IN) * Ingolstadt, Germany (license plate code IN) * In, Russia, a town in the Jewish Autonomous Oblast Businesses and organizations * Independ ...
(ISE). It applies to predicates of the form expr \in \. In this case, it generates test classes such that a predicate of the form expr = expr_ is added to each of them. *
Mandatory Test Set Mandate most often refers to: * League of Nations mandates, quasi-colonial territories established under Article 22 of the Covenant of the League of Nations, 28 June 1919 * Mandate (politics), the power granted by an electorate Mandate may also r ...
(MTS). This tactic associates a set of constant values to a VIS' variable and generates as many test classes as elements are in the set. Each test class is characterized by a predicate of the form var = val where is the name of the variable and is one of the values of the set. *
Numeric Range A number is a mathematical object used to count, measure, and label. The original examples are the natural numbers 1, 2, 3, 4, and so forth. Numbers can be represented in language with number words. More universally, individual numbers can ...
s (NR). This tactic applies only to VIS' variables of type \mathbb (or its "subtype" \mathbb). It consists in associating a range to a variable and deriving test classes by comparing the variable with the limits of the range in some ways. More formally, let be a variable of type \mathbb and let ,j/math> be the associated range. Then, the tactic generates the test classes characterized by the following predicates: n, n=i, i, n=j, n>j. *
Free Type Free may refer to: Concept * Freedom, having the ability to do something, without having to obey anyone/anything * Freethought, a position that beliefs should be formed only on the basis of logic, reason, and empiricism * Emancipate, to procure ...
(FT). This tactic generates as many test classes as elements a free (enumerated) type has. In other words, if a model defines type and some operation uses of type , then by applying this tactic each test class will by divided into three new test classes: one in which equals , the other in which equals , and the third where equals . *
Proper Subset of Set Extension Proper may refer to: Mathematics * Proper map, in topology, a property of continuous function between topological spaces, if inverse images of compact subsets are compact * Proper morphism, in algebraic geometry, an analogue of a proper map for ...
(PSSE). This tactic uses the same concept of ISE but applied to set inclusions. PSSE helps to test operations including predicates like expr \subset \. When PSSE is applied it generates 2^ - 1 test classes where a predicate of the form expr = A_ with i \in , 2^ -1/math> and A_ \in \mathbb \ \setminus \, is added to each class. \ is excluded from \mathbb \ because is a proper subset of \. *
Subset of Set Extension In mathematics, set ''A'' is a subset of a set ''B'' if all elements of ''A'' are also elements of ''B''; ''B'' is then a superset of ''A''. It is possible for ''A'' and ''B'' to be equal; if they are unequal, then ''A'' is a proper subset of ...
(SSE). It is identical to PSSE but it applies to predicates of the form expr \subseteq \ in which case it generates 2^ by considering also \.


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 propose to use the Z notation to build the tree, as follows. \begin VIS &

P\ TCL_^ &

P_^\ &\dots\\ TCL_^ &

P_^\ TCL_^ &

P_^\ &\dots\\ TCL_^ &

P_^\ &\dots\\ TCL_^ &

P_^\ &\dots\\ TCL_^ &

P_^\ &\dots\\ &\dots\\ &\dots \end


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_ be the VIS of Op, let x_:T_ \dots x_:T_ be all the variables declared in VIS_, let C_ be a (leaf) test class of the testing tree associated to Op, let P_ \dots P_ be the characteristic predicates of each test class from C_ up to VIS_ (by following the edges from child to parent), and let v_:T_ \dots v_:T_ be n constant values satisfying P_ \land \dots \land P_. Then, an abstract test case of C_ is the Z schema box defined by x_ = v_ \land \dots \land x_ = v_/math>.


See also

*
Model-based testing Model-based testing is an application of model-based design for designing and optionally also executing artifacts to perform software testing or system testing. Models can be used to represent the desired behavior of a system under test (SUT), ...
*
Fastest Fastest is a model-based testing tool that works with specifications written in the Z notation. The tool implements the Test Template Framework (TTF) proposed by Phil Stocks and David Carrington in . Usage Fastest presents a command-line user ...


References

*. *. *.


Notes

{{reflist Computer-related introductions in 1996 Software testing Z notation