A Formal Approach to Conformance Testing Jan Tretmans
Total Page:16
File Type:pdf, Size:1020Kb
A Formal Approach to Conformance Testing Jan Tretmans A Formal Approach to Conformance Testing CIP–GEGEVENS KONINKLIJKE BIBLIOTHEEK, DEN HAAG Tretmans, Gerrit Jan A formal approach to conformance testing / Gerrit Jan Tretmans. – [S.l. : s.n.]. – Ill. Proefschrift Enschede. – Met lit. opg., reg. ISBN 90–9005643–2 Trefw.: communicatiesystemen ; tests. Copyright c 1992 by Jan Tretmans, Hengelo, The Netherlands. A Formal Approach to Conformance Testing PROEFSCHRIFT ter verkrijging van de graad van doctor aan de Universiteit Twente op gezag van de rector magnificus prof. dr. Th.J.A. Popma volgens besluit van het College van Dekanen in het openbaar te verdedigen op donderdag 10 december 1992 te 13.15 uur door Gerrit Jan Tretmans geboren op 27 augustus 1962 te Hengelo Ov. Dit proefschrift is goedgekeurd door de promotor prof. dr. H. Brinksma Abstract In order to assure successful communication between computer systems from different manufacturers, standardized communication protocols are being developed and spec- ified. As a next step implementations of these protocols are needed that conform to these specifications. Testing is a way to check correctness of protocol implementations with respect to their specifications. This activity is known as protocol conformance testing. This thesis deals with a formal approach to protocol conformance testing. Testing is performed based on a formal specification of the protocol. The final aim is to obtain methods for the (automatic) derivation of useful sets of tests from formal specifications. The derived tests should be provably correct, which means that they should not detect errors in correct implementations. Moreover, the derived tests should be meaningful: erroneous implementations should be detected with a high probability. An important aspect is a formal definition of what constitutes correctness, i.e. when does a protocol implementation conform to a protocol specification. Starting points for this thesis are the current, informal approach to conformance testing as it is described in the international standard ISO IS-9646 ”OSI Conformance Testing Methodology and Framework”, and the specification formalisms for distributed systems based on labelled transition systems and process algebra. The most important concepts of the standard ISO IS-9646, and of the specification formalisms used are introduced in chapter 1. Chapter 2 presents a framework for conformance testing. It is derived by giving a formal interpretation to the most important concepts from the standard ISO IS-9646, such as conformance requirement, the meaning of conformance, test purpose, test method, and different kinds of tests. This interpretation is shown to lead naturally to a definition of conformance as a (preorder) relation on the specification formalism. Such a relation is called an implementation relation. In chapter 3 the framework is elaborated with existing implementation relations for labelled transition systems. The relations are introduced using the principle of ob- servations: the behaviour of an implementation is correct if all observations made of the implementation by an environment, can be explained from the behaviour of the specification. In chapter 4 test derivation algorithms are developed for one particular implementation v vi Abstract relation, the relation conf. These algorithms can be used to derive tests from a labelled transition system specification, which are complete and correct: an implementation is correct according to conf if and only if all tests are successful. The test derivation algorithms take labelled transition systems, and consequently they can also be used to derive tests from a behaviour expression in a formal language for which the semantics is defined by a labelled transition system. A problem appears if this labelled transi- tion system is infinite in number of branches or number of states. Infinity prevents the algorithms from being implemented. Therefore the algorithms are transformed into algorithms that work on behaviour expressions. For a simple class of behaviour ex- pressions rules are given with which tests can be derived compositionally from these behaviour expressions. The implementation relations of chapter 3 and the test derivation algorithms of chap- ter 4 assume synchronous communication between the tester and the implementation, as can be modelled by the parallel synchronization operator on labelled transition sys- tems. Chapter 5 shows that this theory is not applicable when the tester and the implementation communicate via a FIFO buffer. Tests derived for synchronous com- munication cannot detect all erroneous implementations, while correct implementations are wrongly considered to be erroneous. To demonstrate this a queue-operator on la- belled transition systems is defined to formalize asynchronous communication between the tester and the implementation. This queue operator models two queues, one for input and one for output. A system that communicates asynchronously with its en- vironment is called a queue-context. It is shown that the behaviour of queue contexts is characterized by two sets of sequences of actions (traces): sequences that can be performed by a queue context, and sequences that result in a state in which no output is possible. Implementation relations for asynchronous communication are derived, and first steps towards test derivation algorithms for these relations are made. The de- rived tests are translated into TTCN, the standardized test notation from the standard ISO IS-9646. Since TTCN uses a mechanism for communication based on queues this translation makes sense, as opposed to a translation of synchronous tests. Using the test derivation algorithms of chapters 4 and 5, large numbers of tests can be derived. The reduction of the number of tests to an amount that can be handled eco- nomically and practically is called test selection. Chapter 6 studies a framework for test selection based on assigning values and costs to sets of tests. The value is related to the error detecting capability of a set of tests. The framework, which is independent from any specification formalism, is elaborated for labelled transition systems. Moreover, a test selection technique based on specification selection is presented for labelled tran- sition systems. Instead of selecting tests from a too large set of tests, the specification is transformed, such that the tests derived from the transformed, partial specification exactly constitute a selection of the tests derived from the original specification. The last chapter, chapter 7, presents conclusions and a few suggestions for further re- search: the relation between testing and verification, asynchronous communication with other kinds of contexts, extension of test selection methods to realistic specifications, the integration of values and costs, and design for testability of protocols. Finally it is Abstract vii noted that the applicability and shortcomings of all presented ideas need to be validated by applying them to testing realistic protocols. Acknowledgements I am indebted to my promotor Ed Brinksma for his ideas, inspiration, constructive criticism, assistance in the production of this thesis, and being co-author of some of the chapters. Without his help it would have been difficult to complete this thesis. I would like to thank Pim Kars for being my roommate, for reading and commenting almost all my drafts, some of them very immature, and for being there to answer my questions. Louis Verhaard and Jeroen van de Lagemaat were co-authors for some parts of this thesis, for which I thank them. Henk Eertink, Rom Langerak, Arend Rensink, Pippo Scollo, Rudie Alderden, Jan Kroon and Stan van de Burgt are thanked for commenting on earlier versions of some chapters. I would like to thank Chris Vissers for giving me the opportunity to work in the stim- ulating environment of the TIOS group, and all the members of the TIOS group for many enlightning discussions and mental support. Finally, I thank my parents for encouraging and supporting me during my whole study, and And`ele for her love, support, and understanding. Contents Abstract v Acknowledgements viii Contents ix 1 Introduction 1 1.1 Conformance Testing and the Use of Formal Methods . .... 1 1.1.1 ProtocolConformanceTesting . 2 1.1.2 FormalMethods........................... 4 1.1.3 Formal Methods in Protocol Conformance Testing . ... 7 1.2 OverviewoftheThesis ........................... 8 1.3 OverviewofISOIS-9646 .......................... 9 1.3.1 The Conformance Testing Process . 11 1.3.2 AConformingImplementation. 11 1.3.3 TestGeneration........................... 12 1.3.4 TestImplementation . 17 1.3.5 TestExecution ........................... 18 1.4 LabelledTransitionSystems . 19 1.4.1 Representation ........................... 19 1.4.2 Traces ................................ 22 1.4.3 Equality ............................... 23 2 A Formal Framework for Conformance Testing 27 2.1 Introduction................................. 27 2.2 FormalInterpretationofISOIS-9646 . ... 28 2.2.1 TheMeaningofConformance . 28 2.2.2 PICS................................. 31 2.2.3 TestPurposes............................ 32 2.2.4 TestCases.............................. 33 2.2.5 GenericTestCases ......................... 36 2.2.6 AbstractTestCases ........................ 38 2.2.7 TestGenerationinPractice . 42 2.2.8 LimitationsofTesting . 45 2.2.9 PIXIT ................................ 45 2.3 ConformanceasaRelation. .. .. 46 2.4 Examples .................................. 48 2.4.1 Natural Language Specification