Model-based testing with UTP and TTCN-3 and its application ...


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Model-based testing with UTP and TTCN-3 and its application ...

  1. 1. 1 Model-based testing with UTP and TTCN-3 and its application to HL7 Stephan Pietsch, Bogdan Stanca-Kaposta Testing Technologies IST GmbH Abstract As the leading standard in model-based software engineering, UML is also be- ing applied in the area of testing. With the UML Testing Profile (UTP) addi- tional model-elements have been defined enabling the specification of test goals, test procedures and test assessments for system components as well as for com- plete systems. The concepts are based on software-testing concepts as found in JUnit and protocol testing concepts as found in TTCN-3. The Testing and Test Control Notation (TTCN-3) is an international stan- dardized language, having its roots in the area of testing hardware and software components of IT and telecommunications systems. This presentation will shortly introduce the UML Testing Profile and its po- tential application in the software development process for HL7 testing. 1 Introduction Software engineering companies of the automotive, aerospace, telecommunications and IT industry face the challenge to increase both productivity and quality of their products at the same time. Model-based software engineering techniques are considered to ad- dress this challenge, and it has been shown successfully in the past. The Unified Modeling Language (UML) has become widely used as a development technique throughout the software industry. Since its version 2.0 UML can also being applied in the area of testing. With the UML 2.0 Testing Profile [UTP] additional model-elements have been defined enabling the specification of test goals, test proce- dures and test assessments for system components as well as for complete systems. UTP plays an essential role for the alignment of system and test development meth- ods. It therefore contributes substantially to a model-centric system development ap- proach. System models and test models can be developed and aligned in all system de- velopment phases. UTP addresses concepts like test suites, test cases, test configuration, test component and test results, thus enabling the specification of different types of test- ing like, functional, interoperability, scalability and even load testing. Copyright © Testing Technologies 2008
  2. 2. 2 Stephan Pietsch, Bogdan Stanca-Kaposta These core concepts are based on software-testing concepts as found in JUnit and protocol testing concepts as found in TTCN-3. UTP defines these test concepts as a UML based meta-model for the first time. However, its validation, implementation and in particular its application to concrete systems has still to be done. The Testing and Test Control Notation [TTCN-3] is an international standardized language, having its roots in the area of testing hardware and software components of IT and telecommunications systems. The international standard has been developed by the European Telecommunications Standards Institute (ETSI). 2 Development Processes Within a model-centric development process models of different levels of abstraction will be transformed in each other. Therefore it is essential to execute the model trans- formations in a consistent and comprehensible manner. The Object Management Group (OMG) defines in its Model Driven Architecture (MDA) a common tool inde- pendent approach for the compilation of artifacts on different development levels. Arti- facts of a certain level are a composition of a model of the system under development whereas the model description language is defined by a meta-model. One of the most common software development processes is the well-known V- model. We will use it with the extension for the development of the test system – the so called W-model [Spi 02]. Fig. 1: The W-model Copyright © Testing Technologies 2008
  3. 3. Model-based testing with UTP and TTCN-3 and its application to HL7 3 While models can be described by different languages and notations, this paper uses UML for system development and UTP/TTCN-3 for the test development. An UML focused view on the development process is shown in the following figure. Fig. 2: UML focused W-model Model based testing requires the systematic and possibly automated support of concepts and methods for the derivation of artifacts of the respective development phases. Thus meta-models have to be used both for system development and test development. Whereas this is well supported by UML for the system development side, it is on proprietary level only for the test development side, as the standardized testing technol- ogy TTCN-3 is specified without a meta-model. Copyright © Testing Technologies 2008
  4. 4. 4 Stephan Pietsch, Bogdan Stanca-Kaposta Fig. 3: System models and test models The solution described in this paper uses the TTCN-3 meta-model of TTworkbench – an integrated TTCN-3 development and execution platform based on Eclipse. 3 UTP and TTCN-3 The UML Testing Profile extends and restricts the UML. It enables the test definition and test generation based on structural (static) and behavioral (dynamic) aspects of UML models by providing concepts that target the development of test specifications and test models for black-box testing. The mappings to JUnit and TTCN-3 support the automated realization of tests relying on established test frameworks. The Testing and Test Control Notation TTCN-3 is a flexible and powerful test specification and test implementation language that supports all kinds of black-box test- ing. TTCN-3 has a similar look and feel to a typical programming language. However, besides typical programming constructs, it contains all the important features to specify test procedures and campaigns for functional, conformance, interoperability, load and scalability tests. These test-specific features are unique compared to traditional scripting or programming languages, and above all technology-independent. TTCN-3 is suited for a large variety of application domains. Copyright © Testing Technologies 2008
  5. 5. Model-based testing with UTP and TTCN-3 and its application to HL7 5 UTP as well as TTCN-3 are test specification techniques that are open to various domains and to various development and test processes. The following tables give an overview on the usage of UTP and TTCN-3. Tab. 1: Comparison of usage of UTP and TTCN3 UTP TTCN-3 Test Design Supported Not supported Test Specification Supported Supported Test Execution Not directly supported Supported (via derivation only) Test Meta Modeling Supported Partly supported Format Graphical Textual and graphical Transformation UTP to TTCN-3 partly TTCN-3 to UTP sup- supported ported The following tables give an overview on the concept mappings of UTP and TTCN-3. Tab. 2: Comparison of elements of UTP and TTCN3 UTP TTCN-3 Test Suite Test context Module Test Suite Behavior Classifier behavior of Module control test context Test Configuration Internal structure of test Create and context (explicit, fixed (un)map/(dis)connect structures) operations (implicit, flexible structures) Test Verdict Arbiter (flexible verdicts) Built-in functional ver- dict Defaults Default hierarchy along Dynamic default list test structure along test behavior Test Data Date pools and wild- Wildcards and match- cards ing, import of external dat 4 Relation of System Models and Test Models Copyright © Testing Technologies 2008
  6. 6. 6 Stephan Pietsch, Bogdan Stanca-Kaposta For the description of the relation between system model and test model the application of UTP/TTCN-3 based testing to HL7 will be used. Health Level 7 [HL7] is a communication standard that enables data exchange be- tween clinical systems. His apparition brought a light in a heterogeneous software com- munity which had to relay on a large number of conversions and interfaces, each of them implying a high price for the implementation and maintenance but also loss of information. During its evolution it was improving the workflow the healthcare indus- try, bringing quality, accuracy and efficiency to both industry and health care institutes. In the scenario presented here, the client system (Registration System) will query an Master Patient Index (MPI) for a person, when the person exists on both systems. An MPI, being used in the beginning to manage patient identification, was now extended to manage person in general (including patients, subscribers, providers) identification and cross-reference between distributed systems. The following diagram describes the interfaces of MPI as the system under test (SUT). It provides the IMPI interface presenting two query methods described later. The Registration System is emulated by the test system and uses the IMPI interface. The two port type classes at the bottom of the diagram are used to design the communi- cation between test system and SUT. Fig. 4: Patient Registration System Architecture Using the components described above we derived a test system configuration. The two ports of components communicating via a so called HL7Connector as shown in the fol- lowing structure diagram. The default arbiter is used by the underlying test system in order to store the test verdict, i.e. the conclusion of the test execution. Copyright © Testing Technologies 2008
  7. 7. Model-based testing with UTP and TTCN-3 and its application to HL7 7 Fig. 5: Test System Configuration The test behavior, depicted as an interaction diagram, contains the invocation of the operations offered by the IMPI interface. The left component, being the client, will query (findCandidates Q22) the MPI for a person that exists on both systems. The MPI returns (findCandidates K22) a list of pos- sible matching records, and one is chosen by the emulated client component. The emu- lated client component simply asks the MPI for an updated set of demographics (get- PersonDemographics Q21) and does not assign an identifier since the person already exists with identifier on the emulated client system. The MPI returns the Patient Addi- tional Demographics (getPersonDemographics K21). The second query should be per- formed in order to prevent the selection of the wrong person. Copyright © Testing Technologies 2008
  8. 8. 8 Stephan Pietsch, Bogdan Stanca-Kaposta Fig. 6: Test Behavior 5 Model Transformation Model transformers support the MDA approach along the W-model using model reposi- tories for both system models and test models. On the test modeling side model trans- formation techniques are used to convert the content of a UTP repository into a TTCN- 3 repository. As the used TTCN-3 tooling TTworkbench is based on Eclipse, an approach based on the Eclipse Modeling Framework [EMF] for model transformation is being used. Eclipse based UML tools are able to export UML models via the OMG standardized XML Metadata Interchange [XMI] format directly into the UTP repository. XMI sup- port is offered by most of the UML tools and is the common exchange format for mod- eling tools. UML tools that do not support XMI can be integrated via an intermediate model transformation into the UTP repository. Test and domain models from UTP repository can be used as input for a EMF based model transformer. The transformation result will than be stored in a TTCN-3 model repository using a proprietary TTCN-3 meta-model framework. From the TTCN-3 model source code – the TTCN-3 Core Language – can be generated. Copyright © Testing Technologies 2008
  9. 9. Model-based testing with UTP and TTCN-3 and its application to HL7 9 The model transformation approach described above is supported by the TTwork- bench plug-in TTmodeler. The following figure illustrates the model transformation. Fig. 7: Model transformation with TTmodeler Based on the above described UTP model the following TTCN-3 code will be gener- ated by TTmodeler. Listing 1. TTCN-3 Test Behavior for Patient Registration System function ClientRegInteractionClient() runs on RegistrationSystem {{ [] mpiPort.getreplay(findCandidates() value ExpectedK22) });; [] mpiPort.getreplay(getPersionDemografics() value ExpectedK21) }); setverdict(pass); self.stop; } Generated TTCN-3 test cases can be executed fully automatically using a TTCN-3 test execution management tool. 6 Summary Both test specification techniques UTP and TTCN-3 can be applied to various domains and offer support for different kinds and levels of testing. UTP enables high-level test design along UML based design processes. TTCN-3 has its strength in technical testing and automated execution. Combing both together in an UML based development proc- ess makes UML applicable for software testing. Copyright © Testing Technologies 2008
  10. 10. 10 Stephan Pietsch, Bogdan Stanca-Kaposta References [Bak 08] P. Baker et al.: Model Driven Testing. Springer, 2008 [Cha 06] R.Chaparadza et al.: UML2 System Models to U2TP models, U2TP models TTCN-3 models and TTCN-3 Code Generation and Execution, ECMDA Workshop on Integration of Model Driven Develop- ment and Model Driven Testing. Bilbao, 2006 [Dai 06] Z. Dai: An Approach to Model-Driven Testing – Functional and Real-Time Testing with UML 2.0, UTP and TTCN-3. PhD thesis, Technical University Berlin. 2006 [EMF] Eclipse Foundation: Eclipse Modeling Framework Project: [HL7] Health Level Seven: HL7 Version 2.5.1. Ann Arbor, 2007. [Sch 06] I. Schieferdecker et al.: Model Transformers for Test Generation from System Models. CONQUEST Berlin, 2006. [Sch 07] I. Schieferdecker: Modellbasiertes Testen. OBJEKTspektrum Nr. 3, 2007 [Spi 02] A. Spillner: The W-Model Strengthening the Bond Between Development and Test. Orlando, 2002 [TTCN-3] European Telecommunications Standards Institute (ETSI); Methods for Testing and Specification (MTS): The Testing and Test Control Notation version 3 edition 3. Sophia-Antipolis, 2008 [TTworkbench] [UTP] Object Management Group (OMG): UML Testing Profile Version 1.0. Needham, 2005 [Wil 05] C. Willcock et al.: An Introduction to TTCN-3. Wiley, 2005 [XMI] Object Management Group (OMG): MOF 2.0/XMI Mapping Version 2.1.1. Needham, 2007 [Zan 05] J. Zander-Nowicka et al.: From U2TP Models to Executable Tests with TTCN-3 - An Approach to Model Driven Testing. TestCom Montreal, 2005 Copyright © Testing Technologies 2008