An Introductory Overview Anthony Wiles ETSI PTCCETSI STF

  • Slides: 98
Download presentation
An Introductory Overview Anthony Wiles ETSI PTCC/ETSI STF 156 TTCN-3 An Introductory Overview, Copyright

An Introductory Overview Anthony Wiles ETSI PTCC/ETSI STF 156 TTCN-3 An Introductory Overview, Copyright ETSI 2000

Presentation Outline 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Basic Concepts

Presentation Outline 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Basic Concepts Structure and Contents of a TTCN-3 Test Suite TTCN-3 Data Types Defining Test Data Specifying elements of Test System Architecture Specifying Test System Behaviour TTCN-3 Program Statements and Operations Creating, Building and Controlling Test Configurations Communication Between Test Components TTCN-3 Behaviour Trees 11. Timers, Verdicts and SUT Operations 12. Executing and Controlling Test Cases 13. Specifying Additional Attributes TTCN-3 An Introductory Overview, Copyright ETSI 2000

Basic Concepts TTCN-3 An Introductory Overview, Copyright ETSI 2000

Basic Concepts TTCN-3 An Introductory Overview, Copyright ETSI 2000

History of TTCN • TTCN: Tree and Tabular Combined Notation • Versions 1 and

History of TTCN • TTCN: Tree and Tabular Combined Notation • Versions 1 and 2 developed by ISO SC 21 WG 3 (1984 1997) as part of the widely-used ISO/IEC 9646 conformance testing standard – ISO/IEC 9646 -3 and ITU-T X. 292 – Updates/maintenance by ETSI in TR 101 666 (TTCN-2++) • Version 3 developed by ETSI TC MTS (1998 - 2000) – Specialist Task Forces STF 133 & STF 156 TTCN-3 An Introductory Overview, Copyright ETSI 2000 4

TTCN-3 Standard Documents • Three-part ETSI Standard (ES) – DES/MTS-00063 -1 : Core Language

TTCN-3 Standard Documents • Three-part ETSI Standard (ES) – DES/MTS-00063 -1 : Core Language TTCN-3 – DES/MTS-00063 -2 : Tabular Presentation Format – DES/MTS-00063 -3 : MSC Presentation Format • ITU-T equivalents Z. 140, Z. 141, Z. 142 • Additional Documents – DTR/MTS-00069 : TTCN-2 to TTCN-3 Mapping – DTS/MTS-00070 : Library of Predefined Functions TTCN-3 An Introductory Overview, Copyright ETSI 2000 5

Motivation for Producing TTCN -3 Modernization – technology has changed since TTCN was first

Motivation for Producing TTCN -3 Modernization – technology has changed since TTCN was first developed Wider scope of application – should be applicable to many kinds of test applications not just conformance (development, system, integration, iop …) Harmonization – should be the first choice for test specifiers, implementors and users both for standardized test suites. . . … and as a generic solution in industrial product development TTCN-3 An Introductory Overview, Copyright ETSI 2000 6

Main Capabilities of TTCN-3 • Dynamic concurrent testing configurations • Various communication mechanisms (synch

Main Capabilities of TTCN-3 • Dynamic concurrent testing configurations • Various communication mechanisms (synch and asynch) • Data and signature templates with powerful matching mechanisms • Specification of encoding information • Display and user-defined attributes • Test suite parameterization • Test case control and selection mechanisms • Assignment and handling of test verdicts • Harmonized with ASN. 1 • Different presentation formats • Well-defined syntax, static semantics and operational semantics TTCN-3 An Introductory Overview, Copyright ETSI 2000 7

The Core Language Text format Tabular Format TTCN-3 Core Language MSC Format Presentation Format

The Core Language Text format Tabular Format TTCN-3 Core Language MSC Format Presentation Format 3 Presentation Formatn TTCN-3 An Introductory Overview, Copyright ETSI 2000 • Core format is a text based language • Core can be viewed as text or in various presentation formats • Tabular format for conformance testing • Message Sequence Chart (MSC)format • Other standardized formats in the future • Proprietary formats 8

Example Core (Text) Format function PO 49901(integer FL) runs on My. MTC { L

Example Core (Text) Format function PO 49901(integer FL) runs on My. MTC { L 0. send(A_RL 3(FL, CREF 1, 16)); TAC. start; alt { [] L 0. receive(A_RC 1((FL+1) mod 2)) { TAC. cancel; verdict. set(pass) } [] TAC. timeout { verdict. set(inconc) } [] any. receive { verdict. set(fail) } } END_PTC 1() // postamble as function call } TTCN-3 An Introductory Overview, Copyright ETSI 2000 9

Example Tabular Format TTCN-3 An Introductory Overview, Copyright ETSI 2000 10

Example Tabular Format TTCN-3 An Introductory Overview, Copyright ETSI 2000 10

Example MSC Format TTCN-3 An Introductory Overview, Copyright ETSI 2000 11

Example MSC Format TTCN-3 An Introductory Overview, Copyright ETSI 2000 11

Use With Other Languages ASN. 1 Types & Values Other types & Values 2

Use With Other Languages ASN. 1 Types & Values Other types & Values 2 • TTCN can be integrated with other 'type and value' systems TTCN-3 Core Language • Fully harmonized with ASN. 1 (1997) • Harmonization possible with other type and value systems (possibly from proprietary languages) Other types & Valuesn TTCN-3 An Introductory Overview, Copyright ETSI 2000 12

Major Elements of TTCN-3 Core Data Types Test Data Test System Architecture Test Behaviour

Major Elements of TTCN-3 Core Data Types Test Data Test System Architecture Test Behaviour • Built-in and user-defined generic data types (e. g. , to define messages, service primitives, information elements, PDUs) • Actual test data transmitted/received during testing • Definition of the components and communication ports that are used to build various testing configurations • Specification of the dynamic test system behaviour TTCN-3 An Introductory Overview, Copyright ETSI 2000 13

Structure and Contents of a TTCN-3 Test Suite TTCN-3 An Introductory Overview, Copyright ETSI

Structure and Contents of a TTCN-3 Test Suite TTCN-3 An Introductory Overview, Copyright ETSI 2000

TTCN-3 Modules Module (…) Module Definitions Module Control Attributes • Modules are the building

TTCN-3 Modules Module (…) Module Definitions Module Control Attributes • Modules are the building blocks of all TTCN-3 specifications • A test suite is a module • A module has a definitions part and a control part • Modules can be parameterised • Modules can import definitions from other modules • Modules can have attributes TTCN-3 An Introductory Overview, Copyright ETSI 2000 15

Example of Module Structure module My. Module (integer My. TSPar 1) { : //

Example of Module Structure module My. Module (integer My. TSPar 1) { : // Definitions part control { : } // Control part } with display “ETSI format”; TTCN-3 An Introductory Overview, Copyright ETSI 2000 16

Module Definitions Data Types Constants RP Signatures Data Templates Signature Templates Communication Ports Test

Module Definitions Data Types Constants RP Signatures Data Templates Signature Templates Communication Ports Test Components Functions Named Alternatives • Definitions are global to the entire module • Data Type definitions are based on the TTCN-3 predefined types • Templates and Signatures define the test data • Ports and Components are used in Test Configurations • Functions, Named Alts and Test Cases define behaviour Test Cases TTCN-3 An Introductory Overview, Copyright ETSI 2000 17

Importing Definitions // Importing single definitions import template My. Template from My. Module; //

Importing Definitions // Importing single definitions import template My. Template from My. Module; // Importing definitions of the same kind import all template from My. Module; // Importing all definitions import all from My. Module; // inhibiting recursive import template My. Template from My. Module nonrecursive; /* To avoid name clashes the imported definition is prefixed with the identifier of the source module */ TTCN-3 An Introductory Overview, Copyright ETSI 2000 18

External Definitions // External constants may be defined external const integer My. External. Const;

External Definitions // External constants may be defined external const integer My. External. Const; // External functions may be defined external function My. Function 4() return integer; TTCN-3 An Introductory Overview, Copyright ETSI 2000 19

Groups of Definitions // A nested group of function group My. Test. Step. Library

Groups of Definitions // A nested group of function group My. Test. Step. Library { group My. Group 1 { function My. Test. Step 11 { : function My. Test. Step 1 n { } group My. Group 2 { function My. Test. Step 21 { : function My. Test. Step 2 n { } } TTCN-3 An Introductory Overview, Copyright ETSI 2000 definitions … } … } 20

TTCN-3 Data Types TTCN-3 An Introductory Overview, Copyright ETSI 2000

TTCN-3 Data Types TTCN-3 An Introductory Overview, Copyright ETSI 2000

TTCN-3 Base Types TTCN-3 An Introductory Overview, Copyright ETSI 2000 22

TTCN-3 Base Types TTCN-3 An Introductory Overview, Copyright ETSI 2000 22

Example of Integer Type /* integer sub-type RANGE definition */ type integer My. Integer.

Example of Integer Type /* integer sub-type RANGE definition */ type integer My. Integer. Range (1. . 100) type integer My. Integer. Range (0. . infinity) /* integer sub-type LIST definition */ type integer My. Integer. List (1 , 2, 3, 4) /* integer sub-type as a mixed LIST and RANGE */ type integer My. Integer. List. And. Range (1. . 5, 7, 9) TTCN-3 An Introductory Overview, Copyright ETSI 2000 23

Example of a Structured Type // record type definition type record My. Message. Type

Example of a Structured Type // record type definition type record My. Message. Type { integer field 1 optional, boolean field 2 } // record value notation var My. Message. Type My. Message { field 1 1, field 2 true } // Individual field assignment My. Message. field 2 : = false TTCN-3 An Introductory Overview, Copyright ETSI 2000 24

Arrays /* Arrays are not considered to be types in TTCN-3. Instead, they are

Arrays /* Arrays are not considered to be types in TTCN-3. Instead, they are specified at the point of variable declaration */ // integer array of 5 elements var integer My. Array[5]; // indexing starts at zero My. Array[0]: = 1; // An initialiser may be used to set array values My. Array : = {1, 2, 3, 4, 5}; TTCN-3 An Introductory Overview, Copyright ETSI 2000 25

ASN. 1 Type Compatibility • The following ASN. 1 types are considered to be

ASN. 1 Type Compatibility • The following ASN. 1 types are considered to be equivalent to their TTCN-3 counterparts • TTCN-3 value notation, operators etc. may be used on values of these types a TTCN module ASN. 1 types INTEGER BOOLEAN OBJECT IDENTIFIER BIT STRING OCTET STRING SEQUENCE OF SET OF ENUMERATED CHOICE TTCN types integer boolean objectidentifier bitstring octetstring sequence of set of enumerated union TTCN-3 An Introductory Overview, Copyright ETSI 2000

Defining Test Data TTCN-3 An Introductory Overview, Copyright ETSI 2000

Defining Test Data TTCN-3 An Introductory Overview, Copyright ETSI 2000

Different Uses of Data in TTCN-3 Test Specifications • Data in TTCN-3 is used

Different Uses of Data in TTCN-3 Test Specifications • Data in TTCN-3 is used – internally to the test component – as information passed between test components within the test system – as test data transmitted to and received from the System Under Test (SUT) • The grouping mechanism can be used to collect data definitions of a similar ‘kind’ e. g. , – Service Primitives (ASP) – Protocol Data Units (PDU) – internal coordination messages TTCN-3 An Introductory Overview, Copyright ETSI 2000 28

Constants (and Variables) /* Constants are defined in the definitions part of a module

Constants (and Variables) /* Constants are defined in the definitions part of a module (and inside functions and test components) */ constant integer My. Constant : = 1; /* Variables can only be declared in the module control part (and inside functions and test components) TTCN-3 does not support global variables */ var hexstring My. Hex. String; TTCN-3 An Introductory Overview, Copyright ETSI 2000 29

Example Message Definition // Complex messages can be defined by records Type record My.

Example Message Definition // Complex messages can be defined by records Type record My. Message. Type My. Message : = { field 1 integer optional, field 2 integer, field 3 integer, field 4 integer, field 5 boolean optional, field 6 hexstring optional, field 7 Another. Message. Type, field 8 bitstring, field 9 charstring (1. . 20) } TTCN-3 An Introductory Overview, Copyright ETSI 2000 30

Data Templates • Templates are special data values that have the following characteristics –

Data Templates • Templates are special data values that have the following characteristics – matching mechanisms – they can be parameterised – they can be modified to provide a simple form of inheritance • Templates can be applied to simple types as well as complex types • Are most often used to define the possible received values of messages and responses to remote procedure calls TTCN-3 An Introductory Overview, Copyright ETSI 2000 31

Matching Mechanisms TTCN-3 An Introductory Overview, Copyright ETSI 2000 32

Matching Mechanisms TTCN-3 An Introductory Overview, Copyright ETSI 2000 32

Examples of Simple Templates /* Template for a simple integer type */ template integer

Examples of Simple Templates /* Template for a simple integer type */ template integer My. Data 1 : = *; template integer My. Data 2 : = (1, 2, 3); /* This line in a test behaviour description will match any incoming integer value */ P 1. receive(My. Data 1); /* This line will match on one of the incoming integer values 1, 2 or 3 */ P 1. receive(My. Data 2); TTCN-3 An Introductory Overview, Copyright ETSI 2000 33

Example Message Template template My. Message. Type My. Message : = { field 1

Example Message Template template My. Message. Type My. Message : = { field 1 1 ifpresent, field 2 (1, 2, 3), field 3 (0. . 255), field 4 not (1, 2, 3), field 5 omit, field 6 * ifpresent, field 7 ? , field 8 ‘ 1011? 110*1’B, field 9 “abc” <*> “xyz” length (20) } TTCN-3 An Introductory Overview, Copyright ETSI 2000 34

Parameterised Templates (1) // Value parameterisation template My. Message. Type My. Message (integer My.

Parameterised Templates (1) // Value parameterisation template My. Message. Type My. Message (integer My. Par) : = { field 1 My. Par, field 2 true field 3 ‘ 110011’B } // Example use of this template P 1. send(My. Message(1)); TTCN-3 An Introductory Overview, Copyright ETSI 2000 35

Parameterised Templates (2) // Type parameterisation type record My. Record. Type(My. Meta. Type) {

Parameterised Templates (2) // Type parameterisation type record My. Record. Type(My. Meta. Type) { boolean field 1, My. Meta. Type field 2 // field 2 type not defined } var My. Record. Type(integer) My. Record. Value : = { field 1 : = true, field 2 : = 123 // field 2 now of type integer } TTCN-3 An Introductory Overview, Copyright ETSI 2000 36

Modified Templates // Writing template My. Message. Type My. Message 1 { field 1

Modified Templates // Writing template My. Message. Type My. Message 1 { field 1 123, field 2 true } // and template My. Message. Type My. Message 2 modifies My. Message 1 { field 2 false } // Is the same as writing template My. Message. Type My. Message 3 { field 1 123, field 2 false } TTCN-3 An Introductory Overview, Copyright ETSI 2000 37

Local Function Definitions /* Functions can declare local constants, variables and timers */ function

Local Function Definitions /* Functions can declare local constants, variables and timers */ function My. Function { const hexstring My. Const : = ‘FF 00’H; var integer My. Var : =1; timer My. Timer; : } TTCN-3 An Introductory Overview, Copyright ETSI 2000 38

Procedure Signatures /* Procedure signatures are needed for synchronous communication over procedure-based ports (remote

Procedure Signatures /* Procedure signatures are needed for synchronous communication over procedure-based ports (remote procedure calls) */ signature My. Remote. Proc ( in integer Par 1, out float Par 2, inout integer Par 3 ) return integer exception (Except. Type 1, Except. Type 2); TTCN-3 An Introductory Overview, Copyright ETSI 2000 39

Signature Templates signature My. Remote. Proc ( in integer Par 1, out float Par

Signature Templates signature My. Remote. Proc ( in integer Par 1, out float Par 2, inout integer Par 3 ) return integer exception (Except. Type 1, Except. Type 2); /* templates may be used to define the actual parameters to a remote procedure call */ template My. Remote. Proc Mytemplate : = { Par 1 : = 7, Par 2 : = *, Par 3 : = My. Const } TTCN-3 An Introductory Overview, Copyright ETSI 2000 40

Specifying Elements of Test System Architecture TTCN-3 An Introductory Overview, Copyright ETSI 2000

Specifying Elements of Test System Architecture TTCN-3 An Introductory Overview, Copyright ETSI 2000

Test Components Test Component Local Declarations Ports Used • Test components are the entities

Test Components Test Component Local Declarations Ports Used • Test components are the entities on which test behaviour is executed (in parallel) • Declarations may be made locally in the component • A list of the ports used by the component must also be given • Actual configurations are built dynamically in the test behaviour using operations such as create, connect etc. TTCN-3 An Introductory Overview, Copyright ETSI 2000 42

Kinds of Test Components • There are three ‘kinds’ of component – MTC (Main

Kinds of Test Components • There are three ‘kinds’ of component – MTC (Main Test Component) – PTC (Parallel Test Component) – a PTC that defines the Abstract Test System Interface Abstract Test System MTC 1 PTC 2 PTCn Abstract Test System Interface Real test system connected to an SUT TTCN-3 An Introductory Overview, Copyright ETSI 2000 43

Communication Ports • Test components communicate via communication ports • A test port is

Communication Ports • Test components communicate via communication ports • A test port is modeled as an infinite FIFO queue • Ports have direction (in, out, inout) • There are three types of port – message-based, procedure-based or mixed PTC 1 P 1 (out) P 1 (in) P 1. send(Msg) TTCN-3 An Introductory Overview, Copyright ETSI 2000 PTC 2 P 1. receive(Msg) 44

Example Port Definition // Definition of a message-based port type port My. Message. Port.

Example Port Definition // Definition of a message-based port type port My. Message. Port. Type message { in Msg. Type 1, Msg. Type 2; out Msg. Type 3; inout integer } // Definition of a procedure-based port type port My. Procedure. Port. Type procedure { out Procedure. Signature 1, Procedure. Signature 2 } TTCN-3 An Introductory Overview, Copyright ETSI 2000 45

Example Component Definition // Definition of test component type component My. Component. Type {

Example Component Definition // Definition of test component type component My. Component. Type { // Local declarations var integer My. Var; timer My. Timer; // Ports used by the component My. Message. Port. Type P 1, P 2; My. Procedure. Port. Type P 3 } TTCN-3 An Introductory Overview, Copyright ETSI 2000 46

Test System Interface /* A user-defined component that defines the port interface to the

Test System Interface /* A user-defined component that defines the port interface to the underlying real test system */ type component My. Test. System. Inteface. Type { My. Lower. PCOType LT; My. Upper. PCOType UT } TTCN-3 An Introductory Overview, Copyright ETSI 2000 47

Specifying Test System Behaviour TTCN-3 An Introductory Overview, Copyright ETSI 2000

Specifying Test System Behaviour TTCN-3 An Introductory Overview, Copyright ETSI 2000

TTCN-3 Functions Function (. . . ) Local Declarations Program Part • Functions are

TTCN-3 Functions Function (. . . ) Local Declarations Program Part • Functions are the building-blocks of test system behaviour • Functions have local declarations and a program part • Can be a 'pure' function doing some internal test system task or specify test behaviour using communication operations such as send and receive • External functions are allowed • There are some pre-defined functions (type conversion etc. ) TTCN-3 An Introductory Overview, Copyright ETSI 2000 49

Pre-defined Functions TTCN-3 An Introductory Overview, Copyright ETSI 2000 50

Pre-defined Functions TTCN-3 An Introductory Overview, Copyright ETSI 2000 50

Function Definitions(1) // Functions can be parameterised // in, out, inout paramters. Default is

Function Definitions(1) // Functions can be parameterised // in, out, inout paramters. Default is in function My. Function (in integer My. Par) { : } // Functions can return values // Default is void function My. Function return integer { : } TTCN-3 An Introductory Overview, Copyright ETSI 2000 51

Function Definitions(2) /* This function performs a generic task. It does not use any

Function Definitions(2) /* This function performs a generic task. It does not use any communication operations */ function My. Function { : } /* This function uses communication operations consistent with the ports offered by My. PTC */ function My. Function runs on My. PTC { : } TTCN-3 An Introductory Overview, Copyright ETSI 2000 52

Test Case Definitions Test Case (. . . ) Interface Part System Part Behaviour

Test Case Definitions Test Case (. . . ) Interface Part System Part Behaviour Part • Test cases are a special kind of function executed in the control part of a module • The interface part (runs on) references the MTC on which the test case will run • The system part (system) references the test system interface component. Can be omitted if the test case only consists of an MTC • The Behaviour part defines test case behaviour TTCN-3 An Introductory Overview, Copyright ETSI 2000 53

Example Test Case Definitions // Parallel configuration testcase My. Test. Case() runs on My.

Example Test Case Definitions // Parallel configuration testcase My. Test. Case() runs on My. MTCType system My. Test. System. Type { : // behaviour defined here } // Configuration consists only of an MTC testcase My. Test. Case()runs on My. MTCType { : // behaviour defined here } TTCN-3 An Introductory Overview, Copyright ETSI 2000 54

TTCN-3 Program Statements and Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000

TTCN-3 Program Statements and Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000

Kinds of Statements and Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000 56

Kinds of Statements and Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000 56

Basic Program Statements TTCN-3 An Introductory Overview, Copyright ETSI 2000 57

Basic Program Statements TTCN-3 An Introductory Overview, Copyright ETSI 2000 57

Example Program Statement function My. Function { var integer x, j; for (j: =1;

Example Program Statement function My. Function { var integer x, j; for (j: =1; j<=10; j: =j+1) { if (My. Global. Flag == true) { x: =j*2; log int 2 str(x); } else x : = j*3 } } TTCN-3 An Introductory Overview, Copyright ETSI 2000 58

Operators TTCN-3 An Introductory Overview, Copyright ETSI 2000 59

Operators TTCN-3 An Introductory Overview, Copyright ETSI 2000 59

Creating, Building and Controlling Test Configurations TTCN-3 An Introductory Overview, Copyright ETSI 2000

Creating, Building and Controlling Test Configurations TTCN-3 An Introductory Overview, Copyright ETSI 2000

Configuration Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000 61

Configuration Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000 61

Creating Components • The MTC is the only component that is automatically created when

Creating Components • The MTC is the only component that is automatically created when the test case is executed – all PTCs must be created explicitly using the create operation • The create operation returns the unique component reference for the newly created component • Components can be created at any point in a behaviour description TTCN-3 An Introductory Overview, Copyright ETSI 2000 62

Example of Create // Define a variable of type component My. Component. Type {

Example of Create // Define a variable of type component My. Component. Type { : } // Define a variable of type component var My. Component. Type My. Component; // create the component My. Component : = Mycomponent. Type. create TTCN-3 An Introductory Overview, Copyright ETSI 2000 63

Connecting and Mapping Components Test System IN My. MTC Connected Ports OUT P 1

Connecting and Mapping Components Test System IN My. MTC Connected Ports OUT P 1 OUT My. PTC IN OUT Mapped Ports Abstract Test System Interface OUT P 2 IN PCO IN Real Test System Interface SUT TTCN-3 An Introductory Overview, Copyright ETSI 2000 64

Example of Connect and Map /* The connect operation is used to connect components

Example of Connect and Map /* The connect operation is used to connect components within the test system */ connect(My. PTC: P 1, mtc: P 1) /* The map operation is used to ‘connect’ components to the abstract test system interface */ map(My. PTC: P 2, system: PCO) TTCN-3 An Introductory Overview, Copyright ETSI 2000 65

Communication Between Test Components TTCN-3 An Introductory Overview, Copyright ETSI 2000

Communication Between Test Components TTCN-3 An Introductory Overview, Copyright ETSI 2000

Asynchronous Communication send receive MTC PTC non-blocking TTCN-3 An Introductory Overview, Copyright ETSI 2000

Asynchronous Communication send receive MTC PTC non-blocking TTCN-3 An Introductory Overview, Copyright ETSI 2000 67

Asynchronous Communication Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000 68

Asynchronous Communication Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000 68

Examples of Asynchronous Communication Operations My. Port. send(integer: 5); My. Port. receive(My. Template(5, My.

Examples of Asynchronous Communication Operations My. Port. send(integer: 5); My. Port. receive(My. Template(5, My. Var)); My. Port. receive(A<B) from My. Partner; My. Port. receive(My. Type: *) -> value My. Var; My. Port. receive(integer: 5) -> sender My. Peer; TTCN-3 An Introductory Overview, Copyright ETSI 2000 69

Synchronous Communication call getcall PTC MTC getreply or catch exception reply or raise exception

Synchronous Communication call getcall PTC MTC getreply or catch exception reply or raise exception blocking TTCN-3 An Introductory Overview, Copyright ETSI 2000 blocking 70

Synchronous Communication Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000 71

Synchronous Communication Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000 71

Examples of Synchronous Communication Operations // Calling a remote procedure My. Port. call (My.

Examples of Synchronous Communication Operations // Calling a remote procedure My. Port. call (My. Proc, 30 ms) to My. Peer { [] My. Port. getreply(My. Proc) -> value My. Result; [] My. Port. catch (My. Proc, Exception 1) } // Replying to a remote procedure My. Port. reply (My. Proc) TTCN-3 An Introductory Overview, Copyright ETSI 2000 72

TTCN-3 Behaviour Trees TTCN-3 An Introductory Overview, Copyright ETSI 2000

TTCN-3 Behaviour Trees TTCN-3 An Introductory Overview, Copyright ETSI 2000

Behaviour Statements TTCN-3 An Introductory Overview, Copyright ETSI 2000 74

Behaviour Statements TTCN-3 An Introductory Overview, Copyright ETSI 2000 74

Behaviour Statements // Sequential statements are denoted by a semi-colon function My. Function 1

Behaviour Statements // Sequential statements are denoted by a semi-colon function My. Function 1 { My. Function 2; x: =x+1; My. Port. receive(my. Message); // Blocks execution until message received My. Port. send(My. Message) } TTCN-3 An Introductory Overview, Copyright ETSI 2000 75

Alternative Behaviour • Alternative behaviour is defined using the alt statement • alt statements

Alternative Behaviour • Alternative behaviour is defined using the alt statement • alt statements may only be the receiving communication operations and timer events – receive, trigger, getcall, getreply, catch, check, timeout S 1 S 3 S 2 S 4 S 5 S 7 S 6 S 8 S 9 S 10 S 1; alt {[ ] S 3; S 6; [ ] S 2; alt { [ ] S 4; S 7; [ ] S 5; S 8; alt { [ ] S 9; [ ] S 10; } } } TTCN-3 An Introductory Overview, Copyright ETSI 2000 76

Schematic View of Alternatives • Each alternative consists of – a guard (possibly empty)

Schematic View of Alternatives • Each alternative consists of – a guard (possibly empty) – an event, and – an (optional) sequence of actions (including further alts) • The TTCN-2 concept of snapshot semantics still applies alt guard 1 event 1 actions 1 guard 2 event 2 actions 2 guardn eventn actionsn TTCN-3 An Introductory Overview, Copyright ETSI 2000 77

Example Alt Statement alt { [] My. Port. receive(My. Message 1) { My. Port.

Example Alt Statement alt { [] My. Port. receive(My. Message 1) { My. Port. send(My. Message 4) alt { // Next level } } [x>1] My. Port. receive(My. Message 2); [x<1] My. Port. receive(My. Message 3) } TTCN-3 An Introductory Overview, Copyright ETSI 2000 78

Named Alternatives • Named alternatives (named alt) are descriptions of partial alternatives – defined

Named Alternatives • Named alternatives (named alt) are descriptions of partial alternatives – defined in the module definitions – are named and may be parameterised • Named alternatives are macro-expansions – they are not functions • Can be referenced from anywhere that it is legal to write a normal alt statement • The expand statement allows a named alt to be explicitly expanded inside another set of alternatives TTCN-3 An Introductory Overview, Copyright ETSI 2000 79

Example of Named Alt (1) // Definition in module definitions named alt My. Named.

Example of Named Alt (1) // Definition in module definitions named alt My. Named. Alt { [] L 1. receive(My. Message 1) [] L 1. receive(My. Message 2) } // Use of the named alt testcase TC 101() { My. Named. Alt() // In-line reference in test case alt { [] L 1. receive(My. Message 3); [expand] My. Named. Alt(); // Macro expansion here } } TTCN-3 An Introductory Overview, Copyright ETSI 2000 80

Example of Named Alt (2) // Is the same as testcase TC 101() {

Example of Named Alt (2) // Is the same as testcase TC 101() { alt { [] L 1. receive(My. Message 1) [] L 1. receive(My. Message 2) } alt { [] L 1. receive(My. Message 3) [] L 1. receive(My. Message 1) [] L 1. receive(My. Message 2) } } TTCN-3 An Introductory Overview, Copyright ETSI 2000 81

Default Behaviour • Default behaviour is defined using named alternatives • Defaults must be

Default Behaviour • Default behaviour is defined using named alternatives • Defaults must be explicitly activated and deactivated • The expansion of defaults is applied to the end of the toplevel set of alternatives in an alt statement … • … and to all single receiving operations and timeouts // Note that the single statement L 1. receive(My. Message 1); // is equivalent to alt { [] L 1. receive(My. Message 1)} TTCN-3 An Introductory Overview, Copyright ETSI 2000 82

Activate and Deactivate named alt My. Default { [] L 1. any. receive }

Activate and Deactivate named alt My. Default { [] L 1. any. receive } // Use of the named alt testcase TC 101() { : activate (My. Default) : // Default applies from here deactivate (My. Default) : // Default does not apply from here } TTCN-3 An Introductory Overview, Copyright ETSI 2000 83

Interleaved Behaviour /* The interleave statement specifies all possible combinations of executing a given

Interleaved Behaviour /* The interleave statement specifies all possible combinations of executing a given set of alternative statements */ interleave { [] PCO 1. receive(My. Message. One); [] PCO 1. receive(My. Message. Two); [] PCO 1. receive(My. Message. Three); } TTCN-3 An Introductory Overview, Copyright ETSI 2000 84

Timers, Verdicts and SUT Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000

Timers, Verdicts and SUT Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000

Additional Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000 86

Additional Operations TTCN-3 An Introductory Overview, Copyright ETSI 2000 86

Verdicts • Verdicts: pass, fail, inconc, none, error • each test components has its

Verdicts • Verdicts: pass, fail, inconc, none, error • each test components has its own local verdict – can be written (set) and read (get) • Global verdict returned by Test Case (read-only) Verdict returned by the test case when it terminates V MTC V verdict. set(fail) PTC 1 V verdict. set(pass) TTCN-3 An Introductory Overview, Copyright ETSI 2000 PTC 2 V verdict. set(inconc) 87

Timer Operations // Starting, stopping and reading a timer My. Timer. start(20 E-3)// Default

Timer Operations // Starting, stopping and reading a timer My. Timer. start(20 E-3)// Default unit is secs My. Timer. stop My. Var : = My. Timer. read // Check if a timer is running if (My. Timer. running) { … } // timeout in an alternative : [] My. Timer. timeout : TTCN-3 An Introductory Overview, Copyright ETSI 2000 88

Executing and Controlling Test Cases TTCN-3 An Introductory Overview, Copyright ETSI 2000

Executing and Controlling Test Cases TTCN-3 An Introductory Overview, Copyright ETSI 2000

Module Control Local Control Declarations Test Case Execution • Module control is the ‘dynamic’

Module Control Local Control Declarations Test Case Execution • Module control is the ‘dynamic’ part of a TTCN-3 specification where test cases are executed (execute) • Local declarations, such as variables and timers may be made in the control part • Basic programming statements may be used to select and control the execution of the test cases TTCN-3 An Introductory Overview, Copyright ETSI 2000 90

Local Control Declarations : control { const hexstring My. Const : = ‘FF 00’H;

Local Control Declarations : control { const hexstring My. Const : = ‘FF 00’H; var integer My. Var : =1; timer My. Timer; : } : TTCN-3 An Introductory Overview, Copyright ETSI 2000 91

Executing Test Cases Module My. Module { // Test cases are defined in the

Executing Test Cases Module My. Module { // Test cases are defined in the module definitions testcase My. Test. Case() runs on My. MTC system My. Test. System { // behaviour defined here } control { // and executed in the control part execute (My. Test. Case()) } } TTCN-3 An Introductory Overview, Copyright ETSI 2000 92

Controlling Test Cases // Test Cases return verdicts execute(My. Test. Case()) -> value My.

Controlling Test Cases // Test Cases return verdicts execute(My. Test. Case()) -> value My. Verdict; // Timeouts may be placed on Test Cases execute(My. Test. Case(), 0. 5) -> value My. Verdict; // Test Cases can be used with program statements while (x<10) { x: =x+1; execute(My. Test. Case()) } // Selection of Test Cases if (My. Selection. Expression) execute(My. Test. Case()) TTCN-3 An Introductory Overview, Copyright ETSI 2000 93

Specifying Additional Attributes TTCN-3 An Introductory Overview, Copyright ETSI 2000

Specifying Additional Attributes TTCN-3 An Introductory Overview, Copyright ETSI 2000

Defining Attributes Language Element • Special attributes can be associated with most TTCN-3 language

Defining Attributes Language Element • Special attributes can be associated with most TTCN-3 language elements using the with statement • encoding information (encode) – standardized: ASN. 1 – application specific, proprietary • display information (display) – standardized: tabular and MSC formats Attributes – or proprietary • user-defined (extension) – proprietary TTCN-3 An Introductory Overview, Copyright ETSI 2000

Example Attributes type record { integer ia 5 string boolean } with { display

Example Attributes type record { integer ia 5 string boolean } with { display encode extension } My. PDU field 1, field 2, field 3 “ETSI Tabular : = PDU”; // Tabular PDU “BER”; // Encoding directive “My. Rule” // User specific TTCN-3 An Introductory Overview, Copyright ETSI 2000 96

An Introductory Overview The End TTCN-3 An Introductory Overview, Copyright ETSI 2000

An Introductory Overview The End TTCN-3 An Introductory Overview, Copyright ETSI 2000

… or just the beginning? TTCN-3 An Introductory Overview, Copyright ETSI 2000

… or just the beginning? TTCN-3 An Introductory Overview, Copyright ETSI 2000