TTCN-3 (Testing and Test Control Notation version 3) is a strongly typed testing language used in conformance testing of communicating systems. TTCN-3 is written by ETSI in the ES 201 873 series, and standardized by ITU-T in the Z.160 Series.
TTCN-3 has its own data types and can be combined with ASN.1, IDL, and XML type definitions.
Standard organization The ITU-T TTCN-3 standard is part of the Z Series and is organized in several parts: Z.161 – Core Language: defines the core textual notation Z.162 – Tabular presentation format (TFT): a way to present tests in a tabular format Z.163 – Graphical presentation format (GFT): a way to present tests graphically with a representation similar to MSC Z.164 – Operational semantics: defines how TTCN-3 is executed Z.165 – TRI: defines the API provided and required with a tester Z.166 – TCI: defines the API provided and required with a test controller Z.167 – ASN.1: defines how to use ASN.1 data types in a TTCN-3 test suite Z.168 – IDL to TTCN-3 mapping Z.169 – Using XML schema with TTCN-3
Language organization Module The top-level container in a test suite is a module. It is usually mapped to a single file. Component An execution entity. A test case or a function is executed on a component. Port Components communicate with each other or with the system under test through ports that are mapped to each other. Test case A sequence of sends and receives. When a message is sent to the SUT (System under test), several possible replies can be received. Alternative Since a test case is a sequence of stimuli followed by a set of possible responses, the notation includes alternatives. It is a compact way to list all possible alternatives in a scenario. Template Defines parameter values when sending or verifies parameter values when receiving. The template construct allows complex verifications in a single statement to keep the test case legible. Verdict The result of a test case execution. It has five possible values: , , , , or .
Applications TTCN-3 has been used to define conformance test suites for SIP, WiMAX, and DSRC standard protocols.
The Open Mobile Alliance adopted a strategy in 2008 of using TTCN-3 for translating test cases in enabler test specifications into an executable representation.
The AUTOSAR project promoted the use of TTCN-3 within the automotive industry.
The 3GPP project promoted the use of TTCN-3 within the mobile industry.
Architecture When executing, the test system architecture is organized as follows: TE (TTCN-3 Executable): The executable form of the test suite. TRI (TTCN-3 Runtime Interface): The interface between the TE and the SUT. It is divided into two parts: SA: System Adaptor PA: Platform Adaptor TCI (TTCN-3 Control Interfaces): The interface to control test execution. It is divided into: TM: Test Management TL: Test Logging CD: Coding and Decoding CH: Component Handling
Example code The following is a TTCN-3 example alongside a graphical representation of the scenario as a Message Sequence Chart (MSC).
module TestSystem {
// Define a subtype of integer type integer myNewType (0..50)
// Declare Request struct type with 2 fields type record Request { myNewType param1, charstring param2 }
// Declare Answer struct type with one field type record Answer { myNewType param1 }
// Declare a message-based communication port type port cEnv_type message { out Request; in Answer; }
// Declare the component on which the test case will run type component sSystem { port cEnv_type cEnv; }
// The templates define outgoing parameter values // and verify incoming parameter values template Request Good_Req := {param1 := 42, param2 := "hello !" }; template Answer All_is_OK := {param1 := 0};
// Define testcase1 that will run on sSystem component testcase testcase1() runs on sSystem { // Send Request message with (42, "hello !") as parameters cEnv.send(Good_Req); // An alternative for the 2 possible answers alt
// Do we receive Answer with 0 as parameter []cEnv.receive(All_is_OK)
// Pass verdict ! setverdict(pass)
// Or do we receive something else []cEnv.receive
// Fail verdict setverdict(fail)
// Control part chains test cases execution automatically control { var verdicttype verdict1; verdict1 := execute(testcase1());
See also ASN.1 ETSI TTCN
References
External links
ETSI TTCN-3 User Conference Video introduction to TTCN-3 on YouTube TTCN-3 Quick Reference Card List of TTCN-3 tools Exporting of Use Case Map models (ITU-T Z.151) to TTCN-3 (ITU-T Z.161) A history of TTCN at ITU-T