New Fault Domains for Conformance Testing of Finite State Machines
Abstract
A fault domain reflects a tester’s assumptions about faults that may occur in an implementation and that need to be detected during testing. A fault domain that has been widely studied in the literature on black-box conformance testing is the class of finite state machines (FSMs) with at most states. Numerous strategies for generating test suites have been proposed that guarantee fault coverage for this class. These so-called -complete test suites grow exponentially in , where is the number of states of the specification, so one can only run them for small values of . But the assumption that is small is not realistic in practice. In his seminal paper from 1964, Hennie raised the challenge to design checking experiments in which the number of states may increase appreciably. In order to solve this long-standing open problem, we propose (much larger) fault domains that capture the assumption that all states in an implementation can be reached by first performing a sequence from some set (typically a state cover for the specification), followed by arbitrary inputs, for some small . The number of states of FSMs in these fault domains grows exponentially in . We present a sufficient condition for --completeness of test suites with respect to these fault domains. Our condition implies --completeness of two prominent -complete test suite generation strategies, the Wp and HSI methods. Thus these strategies are complete for much larger fault domains than those for which they were originally designed, and thereby solve Hennie’s challenge. We show that three other prominent -complete methods (H, SPY and SPYH) do not always generate --complete test suites.
Keywords and phrases:
conformance testing, finite state machines, Mealy machines, apartness, observation tree, fault domains, --complete test suitesCopyright and License:
2012 ACM Subject Classification:
Theory of computationAcknowledgements:
This article grew out of earlier work of the first author [35, 37] and the bachelor thesis of the second author [21]. An early version was made available on arXiv [36]. Many thanks to Kirill Bogdanov, Paul Fiterău-Broştean, Dennis Hendriks, Bálint Kocsis, Bram Pellen, Jurriaan Rot, and the anonymous reviewers for their insightfull feedback on earlier versions.Funding:
Supported by NWO project OCENW.M.23.155, Evidence-Driven Black-Box Checking (EVI).Editors:
Patricia Bouyer and Jaco van de PolSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
We revisit the classic problem of black-box conformance testing [18] in a simple setting in which both specifications and implementations can be described as (deterministic, complete) finite state machines (FSMs), a.k.a. Mealy machines. Ideally, given a specification FSM , a tester would like to have a finite set of tests that is complete in the sense that an implementation FSM will pass all tests in if and only if is equivalent to . Unfortunately, such a test suite does not exist: if is the number of inputs in the longest test in then an implementation may behave like for the first inputs, but differently from that point onwards. Even though is not equivalent to , it will pass all tests in . This motivates the use of a fault domain, a collection of FSMs that reflects the tester’s assumptions about faults that may occur in an implementation and that need to be detected during testing. The challenge then becomes to define a fault domain that captures realistic assumptions about possible faults, but still allows for the design of sufficiently small test suites that are complete for the fault domain and can be run within reasonable time.
A fault domain that has been widely studied is the set of finite state machines (FSMs) with at most states. Test suites that detect any fault in this class are called -complete. The idea of -complete test suites can be traced back to Moore [23] and Hennie [12]. Numerous methods for constructing -complete test suites have been proposed, for different types of transition system models, see for instance [39, 3, 41, 9, 28, 26, 18, 6, 27, 30, 31, 32, 38, 22, 16, 35, 10]. We refer to [18, 5, 22] for overviews and further references. The interest in -complete test suites is somewhat surprising, given that in a black-box setting there is typically no sensible way to bound the number of possible states of an implementation to a small . After all, each additional Boolean variable in an implementation potentially doubles the number of extra states. This is problematic in practice, since the size of -complete test suites generated by existing methods grows exponentially in , where is the number of states of the specification. Actually, Moore [23] was not aiming for practical methods and only described gedanken-experiments. He introduced the example of combination lock machines, and was therefore well aware of the combinatorial explosions in -complete test suites. In his seminal paper from 1964, Hennie [12] also observed the exponential blow-up in -complete test suites and wrote “Further work is needed before it will be practical to design checking experiments in which the number of states may increase appreciably.” In two classic papers, Vasilevskii [39] and Chow [3] independently showed that -complete test suites can be constructed with a size that is polynomial in the size of the specification FSM, for a fixed value of . Nevertheless, the test suites generated by their -method grow exponentially in , and so they did not solve the problem raised by Hennie [12].
In this article, we solve the long-standing open problem of Hennie [12] as follows:
-
1.
As an alternative for -completeness, we propose fault domains that contain all FSMs in which any state can be reached by first performing a sequence from some set (typically a state cover for the specification), followed by arbitrary inputs, for some small . These fault domains contain FSMs with a number of extra states that grows exponentially in .
- 2.
-
3.
We show that our sufficient condition implies --completeness of two prominent approaches for test suite generation: the Wp-method of Fujiwara et al [9], and the HSI-method of Luo et al [19] and Petrenko et al [41, 28]. The W-method of Vasilevskii [39] and Chow [3], and the UIOv-method of Chan et al [2] are instances of the Wp-method, and the ADS-method of Lee & Yannakakis [17] and the hybrid ADS method of Smeenk et al [31] are instances of the HSI-method. This means that --completeness of these methods follows as well. Hence these -complete test suite generation methods are complete for much larger fault domains than those for which they were designed originally.
- 4.
The rest of this article is structured as follows. First, Section 2 recalls some basic definitions regarding (partial) Mealy machines, observation trees, and test suites. Section 3 introduces --complete test suites, and shows how they strengthen the notion of -completeness. Next, we present our sufficient condition for --completeness in Section 4. Based on this condition (and its proof), Section 5 establishes --completeness of the Wp and HSI methods, and -completeness of the H-method. Finally, Section 6, discusses implications of our results and directions for future research. All proofs are deferred to the full version of this article available on arXiv.
2 Preliminaries
In this section, we recall a number of key concepts that play a role in this article: partial functions, sequences, Mealy machines, observation trees, and test suites.
2.1 Partial Functions and Sequences
We write to denote that is a partial function from to and write to mean that is defined on , that is, , and conversely write if is undefined for . Often, we identify a partial function with the set . We use Kleene equality on partial functions, which states that on a given argument either both functions are undefined, or both are defined and their values on that argument are equal.
Throughout this paper, we fix a nonempty, finite set of inputs and a set of outputs. We use standard notations for sequences. If is a set then denotes the set of finite sequences (also called words) over . For a natural number, denotes the set of sequences over with length at most . We write to denote the empty sequence, for the set , to denote the sequence consisting of a single element , and (or simply ) to denote the concatenation of two sequences . The concatenation operation is extended to sets of sequences by pointwise extension. We write to denote the length of sequence . For a sequence we say that and are a prefix and a suffix of , respectively. We write iff is a prefix of . A set is prefix-closed if any prefix of a word in is also in , that is, for all with , implies . For , denotes the prefix-closure of , that is, the set of all prefixes of elements of . If is a word over with , then we write for , and for .
2.2 Mealy machines
Next, we recall the definition of Finite State Machines (FSMs) a.k.a. Mealy machines.
Definition 2.1 (Mealy machine).
A Mealy machine is a tuple , where is a finite set of states, is the initial state, is a (partial) transition function, and is a (partial) output function that satisfies , for and . We use superscript to disambiguate to which Mealy machine we refer, e.g. , , and . We write to denote and . We call a state complete iff has an outgoing transition for each input, that is, , for all . A set of states is complete iff each state in is complete. The Mealy machine is complete iff is complete. The transition and output functions are lifted to sequences in the usual way. Let , and . We write to denote and . We write if there is a with , we write if there is a with , and we write if there is a with . If then we say that is reachable via .
A state cover for is a finite, prefix-closed set of input sequences such that, for every , there is a such that is reachable via . A state cover is minimal if each state of is reached by exactly one sequence from . is initially connected if it has a state cover. We will only consider Mealy machines that are initially connected.
Definition 2.2 (Semantics and minimality).
The semantics of a state of a Mealy machine is the map defined by .
States of Mealy machines and , respectively, are equivalent, written , iff . Mealy machines and are equivalent, written , iff their initial states are equivalent: . A Mealy machine is minimal iff, for all pairs of states , iff .
Example 2.3.
Figure 1 shows an example (taken from [22]) with a graphical representation of two minimal, complete Mealy machines that are inequivalent, since the input sequence triggers different output sequences in both machines.
2.3 Observation Trees
A functional simulation is a function between Mealy machines that preserves the initial state and the transition and output functions.
Definition 2.4 (Simulation).
A functional simulation between Mealy machines and is a function satisfying and, for and ,
We write if is a functional simulation between and .
Note that if , each transition of can be matched by a transition of .
For a given Mealy machine , an observation tree for is a Mealy machine itself that represents the inputs and outputs that have been observed during testing of . Using functional simulations, we may define it formally as follows.
Definition 2.5 (Observation tree).
A Mealy machine is a tree iff for each there is a unique s.t. is reachable via . We write for the sequence of inputs leading to . For , we define . For , we write for the unique state with an outgoing transition to . A tree is an observation tree for a Mealy machine iff there is a functional simulation from to .
Example 2.6.
Figure 2 (right) shows an observation tree for the Mealy machine of Figure 2 (left). Mealy machine , an example taken from [32], models the behavior of a turnstile. Initially, the turnstile is locked (), but when a coin is inserted () then, although no response is observed (), the machine becomes unlocked (). When a user pushes the bar () in the initial state, the turnstile is locked (), but when the bar is pushed in the unlocked state it is free () and the user may pass. State colors indicate the functional simulation from to .
2.4 Test Suites
We recall some basic vocabulary of conformance testing for Mealy machines.
Definition 2.7 (Test suites).
Let be a Mealy machine. A sequence with is called a test case (or simply a test) for . A test suite for is a finite set of tests for . A Mealy machine passes test for iff , and passes test suite for iff it passes all tests in .
Observe that when passes a test , it also passes all prefixes of . This means that only the maximal tests from a test suite (tests that are not a proper prefix of another test in ) need to be executed to determine whether passes . Also note that when passes a test , we may conclude .
We like to think of test suites as observation trees. Thus, for instance, the test suite for the Mealy machine of Figure 2(left) corresponds to the observation tree of Figure 2(right). The definition below describes the general procedure for constructing a testing tree for a given test suite for a specification . The states of the testing tree are simply all the prefixes of tests in . Since may be empty but a tree needs to have at least one state, we require that the empty sequence is a state.
Definition 2.8 (Testing tree).
Suppose is a test suite for a Mealy machine . Then the testing tree is the observation tree given by:
-
and ,
-
For all and with , ,
-
For all and with , .
There is a functional simulation from a testing tree to the specification that was used during its construction.
Lemma 2.9.
The function that maps each state of to the state of is a functional simulation.
The next lemma, which follows from the definitions, illustrates the usefulness of testing trees: a Mealy machine passes a test suite for iff there exists a functional simulation from to .
Lemma 2.10.
Suppose and are Mealy machines, is a test suite for , and . Suppose function maps each state of to state of . Then iff passes .
3 Fault Domains and Test Suite Completeness
A fault domain reflects the tester’s assumptions about faults that may occur in an implementation and that need to be detected during testing.
Definition 3.1 (Fault domains and -completeness).
A fault domain is a set of Mealy machines. A test suite for a Mealy machine is -complete if, for each , passes implies .
The next three lemmas are immediate consequences of the above definition. In particular, whenever is -complete, completeness is preserved when we add tests to or remove machines from .
Lemma 3.2.
If and are test suites with and is -complete, then is -complete.
Lemma 3.3.
If and are fault domains with , and is a -complete test suite, then is -complete.
Lemma 3.4.
If a test suite for is both -complete and -complete, then it is -complete.
A particular class of fault domains that has been widely studied is based on the maximal number of states of implementations.
Definition 3.5.
Let . Then fault domain is the set of all Mealy machines with at most states.
In the literature, -complete test suites are usually called -complete. Suppose , where is the number of states of a specification . Given that the size of -complete test suites grows exponentially in , a tester cannot possibly consider all Mealy machines with up to states, if is large. Therefore, we will propose alternative and much larger fault domains that can still be fully explored during testing.
We consider fault domains of Mealy machines in which all states can be reached by first performing an access sequence from a set (typically a state cover of specification ), followed by arbitrary inputs, for some small . These fault domains capture the tester’s assumption that when bugs in the implementation introduce extra states, these extra states can be reached via a few transitions from states reachable via scenarios from . The next definition formally introduces the corresponding fault domains . A somewhat similar notion was previously proposed by Maarse [20], in a specific context with action refinement.
Definition 3.6.
Let be a natural number and let . Then fault domain is the set of all Mealy machines such that every state of can be reached by an input sequence , for some and .
Example 3.7.
Mealy machine from Figure 3 is contained in fault domain , for , since all states of can be reached via at most one transition from the two states and that are reachable via .
Remark 3.8.
The definition of is closely related to the fundamental concept of eccentricity known from graph theory [7]. Consider a directed graph . For vertices , let be the length of a shortest path from to , or if no such a path exists. The eccentricity of a vertex is the maximum distance from to any other vertex:
This definition generalizes naturally to subsets of vertices. The distance from a set of vertices to a vertex , is the length of a shortest path from some vertex in to , or if no such path exists. The eccentricity of a set of vertices is the maximum distance from to any other vertex:
We view Mealy machines as directed graphs in the obvious way. In the example of Figure 3, the eccentricity of initial state is (since every state of can be reached with at most 2 transitions from ) and the eccentricity of state is (since there is no path from to ). The eccentricity of is , since state can be reached with a single transition from , and states and can be reached with a single transition from .
Fault domain can alternatively be defined as the set of Mealy machines for which the eccentricity of the set of states reachable via is at most . Note that, for a set of vertices , can be computed in linear time by contracting all elements of to a single vertex , followed by a breadth-first search from .
The Mealy machine of Figure 3, which is contained in fault domain , has two states ( and ) that are reached via a sequence from , and three extra states that can be reached via a single transition from these two states. More generally, if is a prefix closed set with sequences and the set of inputs contains elements, then at most states can be reached via sequence from , and at most additional states can be reached via a single transition from states already reached by . A second step from may lead to extra states, etc. This leads us to the following proposition.
Proposition 3.9.
Let be prefix closed with , let and . Then fault domain contains Mealy machines with up to states.
This observation implies that the number of states of Mealy machines in grows exponentially in when there are at least inputs. Even for small values of , the number of states may increase appreciably. Consider, for instance, the Mealy machine model for the Free BSD 10.2 TCP server that was obtained through black-box learning by Fiterău-Broştean et al [8]. This model has 55 states and 13 inputs, so if is a minimal state cover, then fault domain contains Mealy machines with up to 9309 states.
Even though the size of Mealy machines in grows exponentially in , fault domain is not contained in fault domain if . For instance, the machine of Figure 2 has two states and is therefore contained in . However, this machine is not contained in if we take . We need to extend in order to obtain a proper inclusion. Suppose that is a minimal state cover for a minimal specification . Then states in reached by sequences from will be pairwise inequivalent. Methods for generating -complete test suites typically first check whether states of implementation reached by sequences from are also inequivalent. So these methods exclude any model in which distinct sequences from reach equivalent states. This motivates the following definition:
Definition 3.10.
Let . Then fault domain is the set of all Mealy machines such that there are with and .
Note that is infinite and contains Mealy machines with arbitrarily many states. Under reasonable assumptions, fault domain is contained in fault domain .
Theorem 3.11.
Let be a finite set of input sequences with . Let and be natural numbers with . Then .
We refer to -complete test suites as --complete. By Theorem 3.11 and Lemma 3.3, any --complete test suite is also -complete, if . The converse of the inclusion of Theorem 3.11 does not hold, as may contain FSMs with an unbounded number of states. The next example illustrates that a test suite can be -complete, but not --complete for a state cover of the specification.
Example 3.12.
The set is a minimal state cover of Mealy machine at the left of Figure 4. Machine is minimal and is a distinguishing sequence since it generates different outputs for each of the three states of . Mealy machine is trivially contained in fault domains and , whereas Mealy machine at the right of Figure 4 is clearly not contained in and .
However, is contained in fault domain since . Note that the set is also a minimal state cover for , and the sequence is also a distinguishing sequence. Using the Wp-method, to be discussed in more detail in Section 5, --complete test suites can easily be built from a state cover and a distinguishing sequence. In particular, the set is a --complete test suite for , and therefore (by Theorem 3.11) also -complete. However, since passes test suite , is not -complete, and thus not --complete.
Below we give an example to show that, for , -complete test suites generated by the SPYH-method [32] are not always --complete, if . Appendix B contains variations of this example, which demonstrate that the SPY-method [30] and the H-method [6] are not --complete either.
Example 3.13.
Consider specification and testing tree from Figure 2. This specification and the corresponding test suite were both taken from [32], where the SPYH-method was used to generate , which was shown to be -complete for . Consider the minimal state cover for . FSM from Figure 3 belongs to fault domain , since all states can be reached via at most one transition from or . Clearly , as input sequence provides a counterexample. Nevertheless, passes test suite . Thus the test suite generated by the SPYH-method [32] is not --complete.
4 A Sufficient Condition for --Completeness
In this section, we describe a sufficient condition for a test suite to be --complete, which (based on ideas of [6, 35, 37]) is phrased entirely in terms of properties of its testing tree. This tree should contain access sequences for each state in the specification, successors for these states for all possible inputs should be present up to depth , and apartness relations between certain states of the tree should hold. Before we present our condition and its correctness proof, we first need to introduce the concepts of apartness, basis and stratification, and study their basic properties.
4.1 Apartness
In our sufficient condition, the concept of apartness, inspired by a similar notion that is standard in constructive real analysis [33, 11], plays a central role.
Definition 4.1 (Apartness).
For a Mealy machine , we say that states are apart (written ) iff there is some such that , , and . We say that is a separating sequence for and . We also call a witness of and write .
Note that the apartness relation is irreflexive and symmetric. For the observation tree of Figure 2 we may derive the following apartness pairs and corresponding witnesses: and . Observe that when two states are apart they are not equivalent, but states that are not equivalent are not necessarily apart. States and , for instance, are neither equivalent nor apart. However, for complete Mealy machines apartness coincides with inequivalence.
The apartness of states expresses that there is a conflict in their semantics, and consequently, apart states can never be identified by a functional simulation.
Lemma 4.2.
For a functional simulation ,
Thus, whenever states are apart in the observation tree , we know that the corresponding states in Mealy machine are distinct. The apartness relation satisfies a weaker version of co-transitivity, stating that if and has the transitions for , then must be apart from at least one of and , or maybe even both.
Lemma 4.3 (Weak co-transitivity).
In every Mealy machine ,
4.2 Basis
In each observation tree, we may identify a basis: an ancestor closed set of states that are pairwise apart. In general, a basis is not uniquely determined, and an observation tree may for instance have different bases with the same size. However, once we have fixed a basis, the remaining states in the tree can be uniquely partitioned by looking at their distance from this basis.
Definition 4.4 (Basis).
Let be an observation tree. A nonempty subset of states is called a basis of if
-
1.
is ancestor-closed: for all , and
-
2.
states in are pairwise apart: for all .
For each state of , the candidate set is the set of basis states that are not apart from : . State is identified if .
Since is nonempty and ancestor-closed, all states on the access path of a basis state are in the basis as well. In particular, the initial state is in the basis. Also note that, by definition, basis states are identified. The next lemma gives some useful properties of a basis.
Lemma 4.5.
Suppose is an observation tree for with and basis such that . Then restricted to is a bijection, is minimal, and is a minimal state cover for .
Whenever a subset of states of a testing tree is a basis, the corresponding test suite is -complete, for .
Lemma 4.6.
Let be a Mealy machine, let be a test suite for , let be a basis for , and let . Then is -complete.
4.3 Stratification
A basis induces a stratification of observation tree : first we have the set of immediate successors of basis states that are not basis states themselves, next the set of immediate successors of states in , etc. In general, contains all states that can be reached via a path of length from .
Definition 4.7 (Stratification).
Let be an observation tree with basis . Then induces a stratification of as follows. For ,
We call the -level frontier and write and .
Example 4.8.
Figure 5 shows the stratification for an observation tree for specification from Figure 1 induced by basis . Witness shows that the three basis states are pairwise apart, and therefore identified. States from sets , , and are marked with different colors.
In Figure 5, is complete, but , and are incomplete (since states of and have no outgoing -transitions, and states of have no outgoing transitions at all). The four states are also identified since , , , and . Two states in are identified since , whereas the other two are not since . Since states in have no outgoing transitions, they are not apart from any other state, and thus .
4.4 A Sufficient Condition for --completeness
We are now prepared to state our characterization theorem.
Theorem 4.9.
Let and be Mealy machines, let be an observation tree for both and , let be a basis for with , let , let be the stratification induced by , and let . Suppose and are complete, all states in are identified, and the following condition holds:
| (1) |
Suppose that . Then .
As a corollary, we obtain a sufficient condition for --completeness.
Corollary 4.10.
Let be a Mealy machine, let be a test suite for , let , let be a basis for with , let , let be the stratification of induced by , and let . Suppose and are complete, all states in are identified, and condition (1) holds. Then is --complete.
The conditions of Corollary 4.10 do not only impose restrictions on testing tree , but also on specification . Suppose that the conditions of Corollary 4.10 hold. Then, by Lemma 2.9, there is a functional simulation . By Lemma 4.5, restricted to is a bijection, is minimal, and is a minimal state cover for . Furthermore, since is complete and restricted to is a bijection, is also complete. Minimality and completeness of specifications are common assumptions in conformance testing.
Example 4.11.
A simple example of the application of Corollary 4.10, is provided by the observation tree from Figure 5 for the specification from Figure 1. This observation tree corresponds to the test suite . We claim that this test suite is --complete, for . Note that condition (1) vacuously holds when . All other conditions of Corollary 4.10 are also met: basis is complete and all states in are identified. Therefore, test suite is --complete. We may slightly optimize the test suite by replacing test by test , since all conditions of the corollary are still met for the reduced testing tree.
The conditions of Corollary 4.10 are sufficient for --completeness, but the following trivial example illustrates that they are not necessary.
Example 4.12.
Consider the Mealy machines of Figure 6, which has a single state, two inputs and , and minimal state cover .
Test suite does not meet the conditions of Corollary 4.10, since the basis of the corresponding testing tree is not complete. Nevertheless, we claim that is --complete. Since is a singleton, the fault domain is empty. The fault domain only contains Mealy machines with a single state, and self-loop transitions for inputs and . Test suite verifies that the outputs of these transitions are in agreement with . Thus, any machine in that passes will be equivalent to . Hence is --complete.
Theorem 4.9 and Corollary 4.10 do not require that all states in are identified, but the other conditions of the theorem/corollary already imply this.
Proposition 4.13.
Let be an observation tree for , a basis for with , the stratification induced by , and . Suppose and are complete, all states in are identified, and condition (1) holds. Then all states in are identified
Appendix A contains an example to illustrate that the converse implication does not hold: even if all states in are identified, condition (1) may not hold. The next proposition asserts that condition (1) implies co-transitivity for a much larger collection of triples, namely triples of a basis state, a state in and a state in , for all .
Proposition 4.14.
Let be an observation tree for , a basis for with , the stratification induced by , and . Suppose and are complete, all states in are identified, and condition (1) holds. Then
As a consequence of the next proposition, condition (1) can be equivalently formulated as
| (2) |
Condition (2) says that apartness is co-transitive for triples of states in the observation tree consisting of a state in , a state in , and a basis state. Co-transitivity is a fundamental property of apartness [33, 11].
Proposition 4.15.
Let be an observation tree for , a basis for , and . Suppose and are states of and is identified. Then
4.5 Algorithm
We will now present an algorithm that checks, for a given observation tree with states, in time, for all pairs of states, whether they are apart or not. In practice, models of realistic protocols often have up to a few dozen states and inputs [24]. This means that if equals 2 or 3, the observation tree will contain up to a few thousand states, and so with some optimization (e.g. on the fly computation of apartness pairs) our algorithm is practical. For larger benchmarks the observation trees already contain millions of states, and our algorithm cannot be applied. Nevertheless, from a theoretical perspective it is interesting to know that the apartness relation (and hence also our sufficient condition for --completeness) can be computed in polynomial time.
Algorithm 1 assumes a total order on the set of inputs and two partial functions and which, for each noninitial state , specify the input and output, respectively, of the unique incoming transition of . It also assumes, for each state , an adjacency list that contains the immediate successors of , sorted on their inputs. The algorithm maintains two Boolean arrays and to record whether a pair of states has been visited or is apart, respectively. Initially, all entries in both arrays are . When exploring a pair of states , Algorithm 1 searches for outgoing transitions of and with the same input label. In this case, if the outputs are different then it concludes that and are apart. Otherwise, if the outputs are the same, it considers the target states and . If the pair has not been visited yet then the algorithm recursively explores whether this pair of states is apart. If and are apart then and are apart as well.
The theorem below asserts the correctness and time complexity of Algorithm 1.
Theorem 4.16.
Algorithm 1 terminates with running time , where . Upon termination, iff , for all .
Once we know the apartness relation, there are several things we can do, e.g., we may check in time whether the conditions of Theorem 4.9 hold (but note that grows exponentially in ). First we check in linear time whether all states in and are complete. Next, in one pass over array , we compute the candidate sets for all frontier states. By Proposition 4.13, if some state in the frontier has a candidate set with more than one element, then the conditions of Theorem 4.9 do not hold. Otherwise, we can check in constant time whether frontier states have the same candidate set. Finally, we check condition (1) with a double for-loop over and .
If we can compute the apartness relation, we may also select appropriate state identifiers on-the-fly in order to generate small --complete test suites (similar to the H-method [6]), and we can check in time whether tests can be removed from a given test suite without compromising --completeness.
5 Deriving Completeness for Existing Methods
In this section, we show how --completeness of two popular algorithms for test suite generation, the Wp and HSI methods, follows from Corollary 4.10. We also present an alternative -completeness proof of the H-method [6], which is a minor variation of the proof of Theorem 4.9. In order to define the Wp and HSI methods, we need certain sets (of sets) of sequences. The following definitions are based on [22]; see [5, 22] for a detailed exposition.
Definition 5.1.
Let be a Mealy machine.
-
A state identifier for a state is a set such that for every inequivalent state , contains a separating sequence for and , i.e., a witness for their apartness.
-
We write or simply for a set that contains a state identifier for each .
-
If is a set of state identifiers, then the flattening is the set .
-
If is a set of input sequences and is a set of state identifiers, then the concatenation is defined as .
-
A set of state identifiers is harmonized if, for each pair of inequivalent states , contains a separating sequence for and . We refer to such a set of state identifiers as a separating family.
Proposition 5.2 (--completeness of the Wp-method).
Let be a complete, minimal Mealy machine, , a minimal state cover for , and a set of state identifiers. Then is a --complete test suite for .
Also --completeness of the HSI-method of Luo et al [19] and Petrenko et al [41, 28] follows from Corollary 4.10 via a similar argument.
Proposition 5.3 (--completeness of the HSI-method).
Let be a complete, minimal Mealy machine, , a minimal state cover for , and a separating family. Then is --complete for .
The -method of [39, 3], and the UIOv-method of [2] are instances of the Wp-method, and the ADS-method of [17] and the hybrid ADS method of [31] are instances of the HSI-method. This means that --completeness of these methods also follows from our results.
The H-method of Dorofeeva et al [6] is based on a variant of our Theorem 4.9 which requires that all states in are identified and replaces condition (1) by
| (3) |
By Proposition 4.14, condition (3) is implied by condition (1) of Theorem 4.9. Appendix B contains an example showing that the H-method is not --complete. However, as shown by [6, Theorem 1], the H-method is -complete. Our condition (1) can be viewed as a strengthening of condition (3) of the H-method, needed for --completeness. Below we present an alternative formulation of the -completeness result for the H-method of [6], restated for our setting. The full version of this article contains a proof of this proposition that uses the same proof technique as Theorem 4.9.
Proposition 5.4 (-completeness of the H-method).
Let be a Mealy machine with states, let be a test suite for , let , let be a basis for with states, let , let be the stratification of induced by , and let with . Suppose and are complete, all states in are identified, and condition (3) holds. Then is -complete.
6 Conclusions and Future Work
In order to solve a long-standing open problem of Hennie [12], we proposed the notion of --completeness. We showed that the fault domain for --completeness is larger than the one for -completeness (if ), and includes FSMs with a number of extra states that grows exponentially in . We provided a sufficient condition for --completeness in terms of apartness of states of the observation induced by a test suite. Our condition can be checked efficiently (in terms of the size of the test suite) and can be used to prove --completeness of the Wp-method of [9] and the HSI-method of [19, 41, 28]. Our results show that the Wp and HSI methods are complete for much larger fault domains than the ones for which they were originally designed. We presented counterexamples to show that the SPY-method [30], the H-method [6], and the SPYH-method [32] are not --complete.
We view our results as an important step towards the definition of fault domains that capture realistic assumptions about possible faults, but still allow for the design of sufficiently small test suites that are complete for the fault domain and can be run within reasonable time. A promising research direction is to reduce the size of the fault domains via reasonable assumptions on the structure of the implementation under test. Kruger et al [16] show that significantly smaller test suites suffice if the fault domains are reduced by making plausible assumptions about the implementation. The same approach can also be applied for the fault domains proposed in this article. We expect that our results will find applications in the area of model learning [1, 25, 34, 13]. Black-box conformance testing, which is used to find counterexamples for hypothesis models, has become the main bottleneck in applications of model learning [34, 40]. This provides motivation and urgency to find fault domains that provide a better fit with applications and allow for smaller test suites [16].
An important question for future research is to explore empirical evidence for the usefulness of our new fault domains: how often are faulty implementations of real systems contained in fault domains , for small and a sensible choice of ? Hübner et al [14] investigated how test generation methods perform for SUTs whose behaviors lie outside the fault domain. They considered some realistic SUTs – SystemC implementations of a ceiling speed monitor and an airbag controller described in SysML – and used mutation operators to introduce bugs in a systematic and automated manner. Their experiments show that -complete test suites generated by the W- and Wp-methods exhibit significantly greater test strength than conventional random testing, even for behavior outside the fault domain. It would be interesting to revisit these experiments and check which fraction of the detected faults is outside but contained in .
Our condition is sufficient but not necessary for completeness. If one can prove, based on the assumptions of the selected fault domain, that two traces and reach the same state both in specification and in implementation , then it makes no difference in test suites whether a suffix is appended after or after . Simão et al [4, 30] were the first to exploit this idea of convergence to reduce the size of test suites in a setting for -completeness. It is future work to adapt these results to reduce the size of --complete test suites. Also, the complexity of deciding whether a test suite is --complete is still unknown. Another direction for future work is to lift our results to partial FSMs with observable nondeterminism, e.g. by adapting the state counting method [28].
Closest to our characterization is the work of Sachtleben [29], who develops unifying frameworks for proving -completeness of test generation methods. Inspired by the H-method, he defines an abstract H-condition that is sufficiently strong to prove -completeness of the Wp, HSI, SPY, H and SPYH methods. Sachtleben [29] also considers partially defined FSMs with observable nondeterminism, and takes convergence into account. Moreover, he mechanized all his proofs using Isabelle. It would be interesting to explore whether the formalization of [29] can be adapted to our notion of --completeness.
An obvious direction for future work is to extend our notion of --completeness to richer classes of models, such as timed automata and register automata. The recent work of [15] may provide some guidance here. It will also be interesting to explore if our characterization can be used for efficient test suite generation, or for pruning test suites that have been generated by other methods.
References
- [1] D. Angluin. Learning regular sets from queries and counterexamples. Inf. Comput., 75(2):87–106, 1987. doi:10.1016/0890-5401(87)90052-6.
- [2] W. Y. L. Chan, C. T. Vuong, and M. R. Otp. An improved protocol test generation procedure based on UIOs. In Proceedings of the ACM Symposium on Communications Architectures & Protocols, September 19-22, 1989, SIGCOMM ’89, pages 283–294, New York, NY, USA, 1989. Association for Computing Machinery. doi:10.1145/75246.75274.
- [3] T.S. Chow. Testing software design modeled by finite-state machines. IEEE Transactions on Software Engineering, 4(3):178–187, 1978. doi:10.1109/TSE.1978.231496.
- [4] Adenilso da Silva Simão, Alexandre Petrenko, and Nina Yevtushenko. Generating reduced tests for FSMs with extra states. In Manuel Núñez, Paul Baker, and Mercedes G. Merayo, editors, Testing of Software and Communication Systems, 21st IFIP WG 6.1 International Conference, TESTCOM 2009 and 9th International Workshop, FATES 2009, Eindhoven, The Netherlands, November 2-4, 2009. Proceedings, volume 5826 of Lecture Notes in Computer Science, pages 129–145. Springer, 2009. doi:10.1007/978-3-642-05031-2_9.
- [5] Rita Dorofeeva, Khaled El-Fakih, Stéphane Maag, Ana R. Cavalli, and Nina Yevtushenko. FSM-based conformance testing methods: A survey annotated with experimental evaluation. Information & Software Technology, 52(12):1286–1297, 2010. doi:10.1016/j.infsof.2010.07.001.
- [6] Rita Dorofeeva, Khaled El-Fakih, and Nina Yevtushenko. An improved conformance testing method. In Farn Wang, editor, Formal Techniques for Networked and Distributed Systems - FORTE 2005, 25th IFIP WG 6.1 International Conference, Taipei, Taiwan, October 2-5, 2005, Proceedings, volume 3731 of Lecture Notes in Computer Science, pages 204–218. Springer, 2005. doi:10.1007/11562436_16.
- [7] Feodor F. Dragan and Arne Leitert. On the minimum eccentricity shortest path problem. Theoretical Computer Science, 694:66–78, 2017. doi:10.1016/j.tcs.2017.07.004.
- [8] P. Fiterău-Broştean, R. Janssen, and F.W. Vaandrager. Combining model learning and model checking to analyze TCP implementations. In S. Chaudhuri and A. Farzan, editors, Proceedings 28th International Conference on Computer Aided Verification (CAV’16), Toronto, Ontario, Canada, volume 9780 of Lecture Notes in Computer Science, pages 454–471. Springer, 2016. doi:10.1007/978-3-319-41540-6_25.
- [9] S. Fujiwara, G. von Bochmann, F. Khendek, M. Amalou, and A. Ghedamsi. Test selection based on finite state models. IEEE Transactions on Software Engineering, 17(6):591–603, 1991. doi:10.1109/32.87284.
- [10] Maciej Gazda and Robert M. Hierons. Model independent refusal trace testing. Science of Computer Programming, 239:103173, 2025. doi:10.1016/j.scico.2024.103173.
- [11] Herman Geuvers and Bart Jacobs. Relating apartness and bisimulation. Logical Methods in Computer Science, Volume 17, Issue 3, July 2021. doi:10.46298/lmcs-17(3:15)2021.
- [12] F. C. Hennie. Fault detecting experiments for sequential circuits. In Proceedings of the Fifth Annual Symposium on Switching Circuit Theory and Logical Design, pages 95–110, 1964. doi:10.1109/SWCT.1964.8.
- [13] Falk Howar and Bernhard Steffen. Active automata learning in practice. In Amel Bennaceur, Reiner Hähnle, and Karl Meinke, editors, Machine Learning for Dynamic Software Analysis: Potentials and Limits: International Dagstuhl Seminar 16172, Dagstuhl Castle, Germany, April 24-27, 2016, Revised Papers, pages 123–148. Springer International Publishing, 2018.
- [14] Felix Hübner, Wen-ling Huang, and Jan Peleska. Experimental evaluation of a novel equivalence class partition testing strategy. Softw. Syst. Model., 18(1):423–443, 2019. doi:10.1007/S10270-017-0595-8.
- [15] Bálint Kocsis and Jurriaan Rot. Complete test suites for automata in monoidal closed categories. In Parosh Aziz Abdulla and Delia Kesner, editors, Foundations of Software Science and Computation Structures - 28th International Conference, FoSSaCS 2025, Held as Part of the International Joint Conferences on Theory and Practice of Software, ETAPS 2025, Hamilton, ON, Canada, May 3-8, 2025, Proceedings, volume 15691 of Lecture Notes in Computer Science, pages 198–219. Springer, 2025. doi:10.1007/978-3-031-90897-2_10.
- [16] Loes Kruger, Sebastian Junges, and Jurriaan Rot. Small test suites for active automata learning. In Bernd Finkbeiner and Laura Kovács, editors, Tools and Algorithms for the Construction and Analysis of Systems - 30th International Conference, TACAS 2024, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2024, Luxembourg City, Luxembourg, April 6-11, 2024, Proceedings, Part II, volume 14571 of Lecture Notes in Computer Science, pages 109–129. Springer, 2024. doi:10.1007/978-3-031-57249-4_6.
- [17] D. Lee and M. Yannakakis. Testing finite-state machines: State identification and verification. IEEE Transactions on Computers, 43(3):306–320, 1994. doi:10.1109/12.272431.
- [18] D. Lee and M. Yannakakis. Principles and methods of testing finite state machines — a survey. Proceedings of the IEEE, 84(8):1090–1123, 1996. doi:10.1109/5.533956.
- [19] Gang Luo, Alexandre Petrenko, and Gregor von Bochmann. Selecting test sequences for partially-specified nondeterministic finite state machines. In Tadanori Mizuno, Teruo Higashino, and Norio Shiratori, editors, Protocol Test Systems: 7th workshop 7th IFIP WG 6.1 international workshop on protocol text systems, pages 95–110, Boston, MA, 1995. Springer US. doi:10.1007/978-0-387-34883-4_6.
- [20] T. Maarse. Active Mealy Machine Learning using Action Refinements. Master thesis, Radboud University Nijmegen, August 2020. URL: https://www.cs.ru.nl/F.Vaandrager/thesis-2019_NWI-IMC048_s4416295.pdf.
- [21] I. Melse. Sufficient Conditions for -Completeness Using Observation Trees and Apartness. Bachelor thesis, ICIS, Radboud University Nijmegen, April 2024. URL: https://www.cs.ru.nl/bachelors-theses/2024/Ivo_Melse___s1088677___Sufficient_Conditions_for_k-completeness_using_Observation_Trees_and_Apartness.pdf.
- [22] J. Moerman. Nominal Techniques and Black Box Testing for Automata Learning. PhD thesis, Radboud University Nijmegen, July 2019.
- [23] E.F. Moore. Gedanken-experiments on sequential machines. In Automata Studies, volume 34 of Annals of Mathematics Studies, pages 129–153. Princeton University Press, 1956.
- [24] Daniel Neider, Rick Smetsers, Frits W. Vaandrager, and Harco Kuppens. Benchmarks for automata learning and conformance testing. In Tiziana Margaria, Susanne Graf, and Kim G. Larsen, editors, Models, Mindsets, Meta: The What, the How, and the Why Not?, volume 11200 of Lecture Notes in Computer Science, pages 390–416. Springer, 2018. doi:10.1007/978-3-030-22348-9_23.
- [25] Doron Peled, Moshe Y. Vardi, and Mihalis Yannakakis. Black box checking. In Jianping Wu, Samuel T. Chanson, and Qiang Gao, editors, Proceedings FORTE, volume 156 of IFIP Conference Proceedings, pages 225–240. Kluwer, 1999.
- [26] A. Petrenko, T. Higashino, and T. Kaji. Handling redundant and additional states in protocol testing. In A. Cavalli and S. Budkowski, editors, Proceedings of the 8th International Workshop on Protocol Test Systems IWPTS ’95, Paris, France, pages 307–322, 1995.
- [27] Alexandre Petrenko and Nina Yevtushenko. Conformance tests as checking experiments for partial nondeterministic FSM. In Wolfgang Grieskamp and Carsten Weise, editors, Formal Approaches to Software Testing, 5th International Workshop, FATES 2005, Edinburgh, UK, July 11, 2005, Revised Selected Papers, volume 3997 of Lecture Notes in Computer Science, pages 118–133. Springer, 2005. doi:10.1007/11759744_9.
- [28] Alexandre Petrenko, Nina Yevtushenko, Alexandre Lebedev, and Anindya Das. Nondeterministic state machines in protocol conformance testing. In Omar Rafiq, editor, Protocol Test Systems, VI, Proceedings of the IFIP TC6/WG6.1 Sixth International Workshop on Protocol Test systems, Pau, France, 28-30 September, 1993, volume C-19 of IFIP Transactions, pages 363–378. North-Holland, 1993.
- [29] Robert Sachtleben. Unifying frameworks for complete test strategies. Science of Computer Programming, 237:103135, 2024. doi:10.1016/j.scico.2024.103135.
- [30] Adenilso Simão, Alexandre Petrenko, and Nina Yevtushenko. On reducing test length for FSMs with extra states. Softw. Test. Verification Reliab., 22(6):435–454, 2012. doi:10.1002/STVR.452.
- [31] Wouter Smeenk, Joshua Moerman, Frits W. Vaandrager, and David N. Jansen. Applying automata learning to embedded control software. In Michael J. Butler, Sylvain Conchon, and Fatiha Zaïdi, editors, Formal Methods and Software Engineering - 17th International Conference on Formal Engineering Methods, ICFEM 2015, France, 2015, Proceedings, volume 9407 of Lecture Notes in Computer Science, pages 67–83. Springer, 2015. doi:10.1007/978-3-319-25423-4_5.
- [32] Michal Soucha and Kirill Bogdanov. SPYH-method: An improvement in testing of finite-state machines. In 2018 IEEE International Conference on Software Testing, Verification and Validation Workshops, ICST Workshops, Västerås, Sweden, April 9-13, 2018, pages 194–203. IEEE Computer Society, 2018. doi:10.1109/ICSTW.2018.00050.
- [33] A. S. Troelstra and H. Schwichtenberg. Basic Proof Theory. Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 2 edition, 2000. doi:10.1017/CBO9781139168717.
- [34] Frits Vaandrager. Model learning. Communications of the ACM, 60(2):86–95, February 2017. doi:10.1145/2967606.
- [35] Frits Vaandrager. A new perspective on conformance testing based on apartness. In Venanzio Capretta, Robbert Krebbers, and Freek Wiedijk, editors, Logics and Type Systems in Theory and Practice: Essays Dedicated to Herman Geuvers on The Occasion of His 60th Birthday, pages 225–240, Cham, 2024. Springer Nature Switzerland. doi:10.1007/978-3-031-61716-4_15.
- [36] Frits W. Vaandrager, Paul Fiterau-Brostean, and Ivo Melse. Completeness of FSM test suites reconsidered. CoRR, abs/2410.19405, 2024. doi:10.48550/arXiv.2410.19405.
- [37] Frits W. Vaandrager, Bharat Garhewal, Jurriaan Rot, and Thorsten Wißmann. A new approach for active automata learning based on apartness. In Dana Fisman and Grigore Rosu, editors, Tools and Algorithms for the Construction and Analysis of Systems - 28th International Conference, TACAS 2022, Munich, Germany, April 2-7, 2022, Proceedings, Part I, volume 13243 of Lecture Notes in Computer Science, pages 223–243. Springer, 2022. doi:10.1007/978-3-030-99524-9_12.
- [38] Petra van den Bos, Ramon Janssen, and Joshua Moerman. n-Complete test suites for IOCO. Softw. Qual. J., 27(2):563–588, 2019. doi:10.1007/S11219-018-9422-X.
- [39] M.P. Vasilevskii. Failure diagnosis of automata. Cybernetics and System Analysis, 9(4):653–665, 1973. (Translated from Kibernetika, No. 4, pp. 98-108, July-August, 1973.). doi:10.1007/BF01068590.
- [40] Nan Yang, Kousar Aslam, Ramon R. H. Schiffelers, Leonard Lensink, Dennis Hendriks, Loek Cleophas, and Alexander Serebrenik. Improving model inference in industry by combining active and passive learning. In Xinyu Wang, David Lo, and Emad Shihab, editors, 26th IEEE International Conference on Software Analysis, Evolution and Reengineering, SANER 2019, Hangzhou, China, February 24-27, 2019, pages 253–263. IEEE, 2019. doi:10.1109/SANER.2019.8668007.
- [41] N. V. Yevtushenko and A. F. Petrenko. Synthesis of test experiments in some classes of automata. Autom. Control Comput. Sci., 24(4):50–55, April 1991.
Appendix A Condition (1) is Needed
Proposition 4.13 establishes that condition (1) implies that all states in are identified. The converse implication does not hold: even if all states in are identified, condition (1) may not hold. The Mealy machines and of Figure 7 present a counterexample with and .
Note that these machines are not equivalent: input sequence distinguishes them. The extra state of behaves similar as state of , but is not equivalent. Figure 8 shows an observation tree for both and .
Observation tree meets all the requirements of Theorem 4.9, except condition (1). One way to think of is that cherry picks distinguishing sequences from to ensure that the states are identified by a sequence for which and agree. Note that and are both complete, and all states in and are identified. However, does not satisfy condition (1) as is not apart from , and . The example shows that without condition (1), Theorem 4.9 doesn’t hold.
Appendix B The SPY and H-methods are not --Complete
Example B.1.
Figure 9(left) shows the running example from the article by Simão, Petrenko and Yevtushenko that introduces the SPY-method [30]. Using this method, a 3-complete test suite , was derived in [30]. Consider the minimal state cover for . Implementation from Figure 9(right) is contained in fault domain , since all states can be reached via at most one transition from and . Clearly , as input sequence provides a counterexample. Nevertheless, passes the derived test suite. Thus the test suite generated by the SPY-method [30] is not --complete.
Example B.2.
Figure 11 shows the tree for a -complete test suite generated by the H-method of Dorofeeva et al [6] for the machine of Figure 10(left). This tree satisfies condition (3) since the only transitions from to that change the candidate set are -transitions, and the sources and targets of those transitions are apart. The machine of Figure 10(right) will pass this test suite, even though the two machines are inequivalent ( is a counterexample). It is easy to check that the machine on the right is in , for . Thus the test suite generated by the H-method is not --complete. Indeed, the test suite does not meet condition (1) since (for example) the states with access sequences and have different candidate sets but are not apart.
