logo资料库

TTCN3核心语言 原版.pdf

第1页 / 共210页
第2页 / 共210页
第3页 / 共210页
第4页 / 共210页
第5页 / 共210页
第6页 / 共210页
第7页 / 共210页
第8页 / 共210页
资料共210页,剩余部分请下载后查看
Intellectual Property Rights
Foreword
1 Scope
2 References
3 Definitions and abbreviations
3.1 Definitions
3.2 Abbreviations
4 Introduction
4.0 General
4.1 The core language and presentation formats
4.2 Unanimity of the specification
4.3 Conformance
5 Basic language elements
5.0 General
5.1 Ordering of language elements
5.2 Parameterization
5.2.0 Static and dynamic parameterization
5.2.1 Parameter passing by reference and by value
5.2.1.0 General
5.2.1.1 Parameters passed by reference
5.2.1.2 Parameters passed by value
5.2.2 Formal and actual parameter lists
5.2.3 Empty formal parameter list
5.2.4 Nested parameter lists
5.2.5 Template-type formal parameters
5.2.5.1 Parameterization with templates and matching attributes
5.2.5.2 Language elements using template-type parameters
5.3 Scope rules
5.3.0 General
5.3.1 Scope of formal parameters
5.3.2 Uniqueness of identifiers
5.4 Identifiers and keywords
6 Types and values
6.0 General
6.1 Basic types and values
6.1.0 Simple basic types and values
6.1.1 Basic string types and values
6.1.2 Accessing individual string elements
6.2 Sub-typing of basic types
6.2.0 General
6.2.1 Lists of values
6.2.2 Ranges
6.2.2.0 General
6.2.2.1 Infinite ranges
6.2.2.2 Mixing lists and ranges
6.2.3 String length restrictions
6.2.4 Pattern sub-typing of character string types
6.2.5 Mixing sub-typing mechanisms
6.2.5.1 Mixing patterns, lists and ranges
6.2.5.2 Using length restriction with other constraints
6.3 Structured types and values
6.3.0 General
6.3.1 Record type and values
6.3.1.0 General
6.3.1.1 Referencing fields of a record type
6.3.1.2 Optional elements in a record
6.3.1.3 Nested type definitions for field types
6.3.2 Set type and values
6.3.2.0 General
6.3.2.1 Referencing fields of a set type
6.3.2.2 Optional elements in a set
6.3.2.3 Nested type definition for field types
6.3.3 Records and sets of single types
6.3.3.0 General
6.3.3.1 Nested type definitions
6.3.4 Enumerated type and values
6.3.5 Unions
6.3.5.0 General
6.3.5.1 Referencing fields of a union type
6.3.5.2 Optionality and union
6.3.5.3 Nested type definition for field types
6.4 The anytype
6.5 Arrays
6.6 Recursive types
6.7 Type compatibility
6.7.0 General
6.7.1 Type compatibility of non-structured types
6.7.2 Type compatibility of structured types
6.7.2.0 General
6.7.2.1 Type compatibility of enumerated types
6.7.2.2 Type compatibility of record and record of types
6.7.2.3 Type compatibility of set and set of types
6.7.2.4 Compatibility between sub-structures
6.7.3 Type compatibility of component types
6.7.4 Type compatibility of communication operations
6.7.5 Type conversion
7 Modules
7.0 General
7.1 Naming of modules
7.2 Module parameters
7.2.0 General
7.2.1 Default values for module parameters
7.3 Module definitions part
7.3.0 General
7.3.1 Groups of definitions
7.4 Module control part
7.5 Importing from modules
7.5.0 General
7.5.1 Structure of importable definitions
7.5.2 Rules on using import
7.5.3 Void
7.5.4 Importing single definitions
7.5.5 Importing all definitions of a module
7.5.6 Importing groups
7.5.7 Importing definitions of the same kind
7.5.8 Handling name clashes on import
7.5.9 Handling multiple references to the same definition
7.5.10 Import definitions from non-TTCN-3 modules
8 Test configurations
8.0 General
8.1 Port communication model
8.2 Restrictions on connections
8.3 Abstract test system interface
8.4 Defining communication port types
8.4.0 General
8.4.1 Mixed ports
8.5 Defining component types
8.5.0 General
8.5.1 Declaring local variables, constants and timers in a component
8.5.2 Defining components with arrays of ports
8.5.3 Extension of component types
8.6 Addressing entities inside the SUT
8.7 Component references
8.8 Defining the test system interface
9 Declaring constants
10 Declaring variables
10.0 General
10.1 Value variables
10.2 Template variables
11 Declaring timers
11.0 General
11.1 Timers as parameters
12 Declaring messages
13 Declaring procedure signatures
13.0 General
13.1 Signatures for blocking and non-blocking communication
13.2 Parameters of procedure signatures
13.3 Value returning remote procedures
13.4 Specifying exceptions
14 Declaring templates
14.0 General
14.1 Declaring message templates
14.1.0 General
14.1.1 Templates for sending messages
14.1.2 Templates for receiving messages
14.2 Declaring signature templates
14.2.0 General
14.2.1 Templates for invoking procedures
14.2.2 Templates for accepting procedure invocations
14.3 Template matching mechanisms
14.3.0 General
14.3.1 Referencing elements of templates or template fields
14.3.1.1 Referencing individual string elements
14.3.1.2 Referencing record and set fields
14.3.1.3 Referencing record of and set of elements
14.4 Parameterization of templates
14.4.0 General
14.5 Void
14.6 Modified templates
14.6.0 General
14.6.1 Parameterization of modified templates
14.6.2 In-line modified templates
14.7 Changing template fields
14.8 Match Operation
14.9 Value of Operation
15 Operators
15.0 General
15.1 Arithmetic operators
15.2 String operators
15.3 Relational operators
15.4 Logical operators
15.5 Bitwise operators
15.6 Shift operators
15.7 Rotate operators
16 Functions and altsteps
16.1 Functions
16.1.0 General
16.1.1 Parameterization of functions
16.1.2 Invoking functions
16.1.3 Predefined functions
16.1.4 Restrictions for functions called from specific places
16.2 Altsteps
16.2.0 General
16.2.1 Parameterization of altsteps
16.2.2 Local definitions in altsteps
16.2.2.0 General
16.2.2.1 Restrictions for the initialization of local definitions in altsteps
16.2.3 Invocation of altsteps
16.3 Functions and altsteps for different component types
17 Test cases
17.0 General
17.1 Parameterization of test cases
18 Overview of program statements and operations
19 Expressions and basic program statements
19.0 General
19.1 Expressions
19.1.0 General
19.1.1 Boolean expressions
19.2 Assignments
19.3 The Log statement
19.4 The Label statement
19.5 The Goto statement
19.6 The If-else statement
19.7 The For statement
19.8 The While statement
19.9 The Do-while statement
19.10 The Stop execution statement
19.11 The Select Case statement
20 Behavioural program statements
20.0 General
20.1 Alternative behaviour
20.1.0 General
20.1.1 Execution of alternative behaviour
20.1.2 Selecting/deselecting an alternative
20.1.3 Else branch in alternatives
20.1.4 Void
20.1.5 Re-evaluation of alt statements
20.1.6 Invocation of altsteps as alternatives
20.2 The Repeat statement
20.3 Interleaved behaviour
20.4 The Return statement
21 Default Handling
21.0 General
21.1 The default mechanism
21.2 Default references
21.3 The activate operation
21.3.0 General
21.3.1 Activation of parameterized altsteps
21.4 The deactivate operation
22 Configuration operations
22.0 General
22.1 The Create operation
22.2 The Connect and Map operations
22.2.0 General
22.2.1 Consistent connections and mappings
22.3 The Disconnect and Unmap operations
22.4 The MTC, System and Self operations
22.5 The Start test component operation
22.6 The Stop test behaviour operation
22.7 The Running operation
22.8 The Done operation
22.9 The Kill test component operation
22.10 The Alive operation
22.11 The Killed operation
22.12 Using component arrays
22.13 Summary of the use of any and all with components
23 Communication operations
23.0 General
23.1 General format of communication operations
23.1.0 General
23.1.1 General format of the sending operations
23.1.2 General format of the receiving operations
23.2 Message-based communication
23.2.0 General
23.2.1 The Send operation
23.2.1.0 General
23.2.1.1 Sending unicast, multicast or broadcast
23.2.2 The Receive operation
23.2.2.0 General
23.2.2.1 Receive any message
23.2.2.2 Receive on any port
23.2.3 The Trigger operation
23.2.3.0 General
23.2.3.1 Trigger on any message
23.2.3.2 Trigger on any port
23.3 Procedure-based communication
23.3.0 General
23.3.1 The Call operation
23.3.1.0 General
23.3.1.1 Handling responses and exceptions to a Call
23.3.1.2 Handling timeout exceptions to the Call
23.3.1.3 Calling blocking procedures without return value, out parameters, inout parameters and exceptions
23.3.1.4 Calling non-blocking procedures
23.3.1.5 Unicast, multicast and broadcast calls of procedures
23.3.2 The Getcall operation
23.3.2.0 General
23.3.2.1 Accepting any call
23.3.2.2 Getcall on any port
23.3.3 The Reply operation
23.3.4 The Getreply operation
23.3.4.0 General
23.3.4.1 Get any reply
23.3.4.2 Get a reply on any port
23.3.5 The Raise operation
23.3.6 The Catch operation
23.3.6.0 General
23.3.6.1 The Timeout exception
23.3.6.2 Catch any exception
23.3.6.3 Catch on any port
23.4 The Check operation
23.4.0 General
23.4.1 The Check any operation
23.4.2 Check on any port
23.5 Controlling communication ports
23.5.0 General
23.5.1 The Clear port operation
23.5.2 The Start port operation
23.5.3 The Stop port operation
23.5.4 The halt port operation
23.6 Use of any and all with ports
24 Timer operations
24.0 General
24.1 The Start timer operation
24.2 The Stop timer operation
24.3 The Read timer operation
24.4 The Running timer operation
24.5 The Timeout operation
24.6 Summary of use of any and all with timers
25 Test verdict operations
25.0 General
25.1 Test case verdict
25.2 Verdict values and overwriting rules
25.2.0 General
25.2.1 Error verdict
26 External actions
27 Module control part
27.0 General
27.1 Execution of test cases
27.2 Termination of test cases
27.3 Controlling execution of test cases
27.4 Selection of Test cases
27.5 Use of timers in control
28 Specifying attributes
28.0 General
28.1 Display attributes
28.2 Encoding of values
28.2.0 General
28.2.1 Encode attributes
28.2.2 Variant attributes
28.2.3 Special strings
28.2.4 Invalid encodings
28.3 Extension attributes
28.4 Scope of attributes
28.5 Overwriting rules for attributes
28.5.1 Additional overwriting rules for variant attributes
28.6 Changing attributes of imported language elements
Annex A (normative): BNF and static semantics
A.1 TTCN-3 BNF
A.1.0 General
A.1.1 Conventions for the syntax description
A.1.2 Statement terminator symbols
A.1.3 Identifiers
A.1.4 Comments
A.1.5 TTCN-3 terminals
A.1.6 TTCN-3 syntax BNF productions
A.1.6.0 TTCN-3 module
A.1.6.1 Module definitions part
A.1.6.1.0 General
A.1.6.1.1 Typedef definitions
A.1.6.1.2 Constant definitions
A.1.6.1.3 Template definitions
A.1.6.1.4 Function definitions
A.1.6.1.5 Signature definitions
A.1.6.1.6 Testcase definitions
A.1.6.1.7 Altstep definitions
A.1.6.1.8 Import definitions
A.1.6.1.9 Group definitions
A.1.6.1.10 External function definitions
A.1.6.1.11 External constant definitions
A.1.6.1.12 Module parameter definitions
A.1.6.2 Control part
A.1.6.2.0 General
A.1.6.2.1 Variable instantiation
A.1.6.2.2 Timer instantiation
A.1.6.2.3 Component operations
A.1.6.2.4 Port operations
A.1.6.2.5 Timer operations
A.1.6.3 Type
A.1.6.4 Value
A.1.6.5 Parameterization
A.1.6.6 With statement
A.1.6.7 Behaviour statements
A.1.6.8 Basic statements
A.1.6.9 Miscellaneous productions
Annex B (normative): Matching incoming values
B.1 Template matching mechanisms
B.1.0 General
B.1.1 Matching specific values
B.1.1.1 Omitting values
B.1.2 Matching mechanisms instead of values
B.1.2.0 General
B.1.2.1 Value list
B.1.2.2 Complemented value list
B.1.2.3 Any value
B.1.2.4 Any value or none
B.1.2.5 Value range
B.1.2.6 SuperSet
B.1.2.7 SubSet
B.1.3 Matching mechanisms inside values
B.1.3.0 General
B.1.3.1 Any element
B.1.3.1.1 Using single character wildcards
B.1.3.2 Any number of elements or no element
B.1.3.2.1 Using multiple character wildcards
B.1.3.3 Permutation
B.1.4 Matching attributes of values
B.1.4.0 General
B.1.4.1 Length restrictions
B.1.4.2 The IfPresent indicator
B.1.5 Matching character pattern
B.1.5.0 General
B.1.5.1 Set expression
B.1.5.2 Reference expression
B.1.5.3 Match expression n times
B.1.5.4 Match a referenced character set
B.1.5.5 Type compatibility rules for patterns
Annex C (normative): Pre-defined TTCN-3 functions
C.0 General exception handling procedures
C.1 Integer to character
C.2 Character to integer
C.3 Integer to universal character
C.4 Universal character to integer
C.5 Bitstring to integer
C.6 Hexstring to integer
C.7 Octetstring to integer
C.8 Charstring to integer
C.9 Integer to bitstring
C.10 Integer to hexstring
C.11 Integer to octetstring
C.12 Integer to charstring
C.13 Length of string type
C.14 Number of elements in a structured value
C.15 The IsPresent function
C.16 The IsChosen function
C.17 The Regexp function
C.18 Bitstring to charstring
C.19 Hexstring to charstring
C.20 Octetstring to character string
C.21 Character string to octetstring
C.22 Bitstring to hexstring
C.23 Hexstring to octetstring
C.24 Bitstring to octetstring
C.25 Hexstring to bitstring
C.26 Octetstring to hexstring
C.27 Octetstring to bitstring
C.28 Integer to float
C.29 Float to integer
C.30 The random number generator function
C.31 The Substring function
C.32 Number of elements in a structured type
C.33 Character string to float
C.34 The Replace function
C.35 Octetstring to character string
C.36 Character string to octetstring
Annex D: Void
Annex E (informative): Library of Useful Types
E.1 Limitations
E.2 Useful TTCN-3 types
E.2.1 Useful simple basic types
E.2.1.0 Signed and unsigned single byte integers
E.2.1.1 Signed and unsigned short integers
E.2.1.2 Signed and unsigned long integers
E.2.1.3 Signed and unsigned longlong integers
E.2.1.4 IEEE 754 floats
E.2.2 Useful character string types
E.2.2.0 UTF-8 character string "utf8string"
E.2.2.1 BMP character string "bmpstring"
E.2.2.2 UTF-16 character string "utf16string"
E.2.2.3 ISO/IEC 8859 character string "iso8859string"
E.2.3 Useful structured types
E.2.3.0 Fixed-point decimal literal
E.2.4 Useful atomic string types
E.2.4.1 Single ISO 646 character type
E.2.4.2 Single universal character type
E.2.4.3 Single bit type
E.2.4.4 Single hex type
E.2.4.5 Single octet type
Annex F (informative): Operations on TTCN-3 active objects
F.1 General
F.2 Test components
F.2.1 Test component references
F.2.2 Dynamic behaviour of PTCs
F.2.3 Dynamic behaviour of the MTC
F.3 Timers
F.4 Ports
F.4.1 Configuration Operations
F.4.2 Port Controlling Operations
F.4.3 Communication Operations
Annex G (informative): Deprecated language features
G.1 Group style definition of module parameters
G.2 Recursive import
G.3 Using all in port type definitions
Annex H (informative): Bibliography
History
ETSI ES 201 873-1 V3.1.1 (2005-06) ETSI Standard Methods for Testing and Specification (MTS); The Testing and Test Control Notation version 3; Part 1: TTCN-3 Core Language
2 ETSI ES 201 873-1 V3.1.1 (2005-06) Reference RES/MTS-00090-1 ttcn3 core Keywords ASN.1, methodology, MTS, testing, TTCN ETSI 650 Route des Lucioles F-06921 Sophia Antipolis Cedex - FRANCE Tel.: +33 4 92 94 42 00 Fax: +33 4 93 65 47 16 Siret N° 348 623 562 00017 - NAF 742 C Association à but non lucratif enregistrée à la Sous-Préfecture de Grasse (06) N° 7803/88 Important notice Individual copies of the present document can be downloaded from: http://www.etsi.org The present document may be made available in more than one electronic version or in print. In any case of existing or perceived difference in contents between such versions, the reference version is the Portable Document Format (PDF). In case of dispute, the reference shall be the printing on ETSI printers of the PDF version kept on a specific network drive within ETSI Secretariat. Users of the present document should be aware that the document may be subject to revision or change of status. Information on the current status of this and other ETSI documents is available at http://portal.etsi.org/tb/status/status.asp If you find errors in the present document, please send your comment to one of the following services: http://portal.etsi.org/chaircor/ETSI_support.asp Copyright Notification No part may be reproduced except as authorized by written permission. The copyright and the foregoing restriction extend to reproduction in all media. © European Telecommunications Standards Institute 2005. All rights reserved. DECTTM, PLUGTESTSTM and UMTSTM are Trade Marks of ETSI registered for the benefit of its Members. TIPHONTM and the TIPHON logo are Trade Marks currently being registered by ETSI for the benefit of its Members. 3GPPTM is a Trade Mark of ETSI registered for the benefit of its Members and of the 3GPP Organizational Partners. ETSI
3 ETSI ES 201 873-1 V3.1.1 (2005-06) Contents 2 3 3.1 3.2 4 4.0 4.1 4.2 4.3 5 5.0 5.1 5.2 5.2.0 5.2.1 5.2.1.0 5.2.1.1 5.2.1.2 5.2.2 5.2.3 5.2.4 5.2.5 5.2.5.1 5.2.5.2 5.3 5.3.0 5.3.1 5.3.2 5.4 Intellectual Property Rights ..............................................................................................................................12 Foreword...........................................................................................................................................................12 Scope ......................................................................................................................................................13 1 References ..............................................................................................................................................13 Definitions and abbreviations.................................................................................................................14 Definitions........................................................................................................................................................14 Abbreviations ...................................................................................................................................................16 Introduction ............................................................................................................................................16 General .............................................................................................................................................................16 The core language and presentation formats ....................................................................................................17 Unanimity of the specification .........................................................................................................................18 Conformance ....................................................................................................................................................18 Basic language elements ........................................................................................................................18 General .............................................................................................................................................................18 Ordering of language elements.........................................................................................................................19 Parameterization...............................................................................................................................................20 Static and dynamic parameterization ..........................................................................................................20 Parameter passing by reference and by value .............................................................................................20 General..................................................................................................................................................20 Parameters passed by reference.............................................................................................................21 Parameters passed by value...................................................................................................................21 Formal and actual parameter lists ...............................................................................................................21 Empty formal parameter list .......................................................................................................................21 Nested parameter lists.................................................................................................................................22 Template-type formal parameters ...............................................................................................................22 Parameterization with templates and matching attributes .....................................................................22 Language elements using template-type parameters.............................................................................23 Scope rules .......................................................................................................................................................23 General........................................................................................................................................................23 Scope of formal parameters ........................................................................................................................24 Uniqueness of identifiers ............................................................................................................................25 Identifiers and keywords ..................................................................................................................................25 Types and values ....................................................................................................................................25 General .............................................................................................................................................................25 Basic types and values......................................................................................................................................26 Simple basic types and values.....................................................................................................................26 Basic string types and values ......................................................................................................................27 Accessing individual string elements..........................................................................................................28 Sub-typing of basic types .................................................................................................................................28 General........................................................................................................................................................28 Lists of values .............................................................................................................................................29 Ranges ........................................................................................................................................................29 General..................................................................................................................................................29 Infinite ranges .......................................................................................................................................29 Mixing lists and ranges .........................................................................................................................29 String length restrictions.............................................................................................................................30 Pattern sub-typing of character string types................................................................................................30 Mixing sub-typing mechanisms..................................................................................................................30 Mixing patterns, lists and ranges...........................................................................................................30 Using length restriction with other constraints......................................................................................31 Structured types and values ..............................................................................................................................31 General........................................................................................................................................................31 Record type and values ...............................................................................................................................33 6 6.0 6.1 6.1.0 6.1.1 6.1.2 6.2 6.2.0 6.2.1 6.2.2 6.2.2.0 6.2.2.1 6.2.2.2 6.2.3 6.2.4 6.2.5 6.2.5.1 6.2.5.2 6.3 6.3.0 6.3.1 ETSI
4 ETSI ES 201 873-1 V3.1.1 (2005-06) 6.3.1.0 6.3.1.1 6.3.1.2 6.3.1.3 6.3.2 6.3.2.0 6.3.2.1 6.3.2.2 6.3.2.3 6.3.3 6.3.3.0 6.3.3.1 6.3.4 6.3.5 6.3.5.0 6.3.5.1 6.3.5.2 6.3.5.3 6.4 6.5 6.6 6.7 6.7.0 6.7.1 6.7.2 6.7.2.0 6.7.2.1 6.7.2.2 6.7.2.3 6.7.2.4 6.7.3 6.7.4 6.7.5 7 7.0 7.1 7.2 7.2.0 7.2.1 7.3 7.3.0 7.3.1 7.4 7.5 7.5.0 7.5.1 7.5.2 7.5.3 7.5.4 7.5.5 7.5.6 7.5.7 7.5.8 7.5.9 7.5.10 8 8.0 8.1 8.2 8.3 General..................................................................................................................................................33 Referencing fields of a record type .......................................................................................................33 Optional elements in a record................................................................................................................34 Nested type definitions for field types ..................................................................................................34 Set type and values .....................................................................................................................................34 General..................................................................................................................................................34 Referencing fields of a set type .............................................................................................................35 Optional elements in a set .....................................................................................................................35 Nested type definition for field types ....................................................................................................35 Records and sets of single types .................................................................................................................35 General..................................................................................................................................................35 Nested type definitions..........................................................................................................................36 Enumerated type and values .......................................................................................................................37 Unions.........................................................................................................................................................38 General..................................................................................................................................................38 Referencing fields of a union type ........................................................................................................38 Optionality and union............................................................................................................................38 Nested type definition for field types ....................................................................................................38 The anytype ......................................................................................................................................................38 Arrays...............................................................................................................................................................39 Recursive types ................................................................................................................................................40 Type compatibility ...........................................................................................................................................41 General........................................................................................................................................................41 Type compatibility of non-structured types ................................................................................................41 Type compatibility of structured types .......................................................................................................42 General..................................................................................................................................................42 Type compatibility of enumerated types ...............................................................................................42 Type compatibility of record and record of types .................................................................................42 Type compatibility of set and set of types.............................................................................................44 Compatibility between sub-structures ...................................................................................................44 Type compatibility of component types......................................................................................................44 Type compatibility of communication operations ......................................................................................45 Type conversion..........................................................................................................................................45 Modules..................................................................................................................................................45 General .............................................................................................................................................................45 Naming of modules ..........................................................................................................................................45 Module parameters ...........................................................................................................................................46 General........................................................................................................................................................46 Default values for module parameters ........................................................................................................46 Module definitions part ....................................................................................................................................46 General........................................................................................................................................................46 Groups of definitions ..................................................................................................................................47 Module control part..........................................................................................................................................48 Importing from modules...................................................................................................................................48 General........................................................................................................................................................48 Structure of importable definitions .............................................................................................................49 Rules on using import .................................................................................................................................50 Void ............................................................................................................................................................52 Importing single definitions........................................................................................................................52 Importing all definitions of a module .........................................................................................................52 Importing groups ........................................................................................................................................53 Importing definitions of the same kind .......................................................................................................53 Handling name clashes on import...............................................................................................................54 Handling multiple references to the same definition ..................................................................................54 Import definitions from non-TTCN-3 modules ..........................................................................................55 Test configurations.................................................................................................................................55 General .............................................................................................................................................................55 Port communication model...............................................................................................................................56 Restrictions on connections..............................................................................................................................56 Abstract test system interface...........................................................................................................................58 ETSI
5 ETSI ES 201 873-1 V3.1.1 (2005-06) 8.4 8.4.0 8.4.1 8.5 8.5.0 8.5.1 8.5.2 8.5.3 8.6 8.7 8.8 Defining communication port types .................................................................................................................59 General........................................................................................................................................................59 Mixed ports.................................................................................................................................................59 Defining component types................................................................................................................................60 General........................................................................................................................................................60 Declaring local variables, constants and timers in a component.................................................................60 Defining components with arrays of ports..................................................................................................61 Extension of component types ....................................................................................................................61 Addressing entities inside the SUT ..................................................................................................................63 Component references......................................................................................................................................63 Defining the test system interface ....................................................................................................................64 Declaring constants ................................................................................................................................65 9 10 Declaring variables.................................................................................................................................65 General .............................................................................................................................................................65 10.0 Value variables.................................................................................................................................................66 10.1 Template variables ...........................................................................................................................................66 10.2 11 Declaring timers .....................................................................................................................................66 General .............................................................................................................................................................66 11.0 Timers as parameters........................................................................................................................................67 11.1 12 Declaring messages ................................................................................................................................67 13 Declaring procedure signatures..............................................................................................................67 General .............................................................................................................................................................67 13.0 Signatures for blocking and non-blocking communication..............................................................................68 13.1 Parameters of procedure signatures..................................................................................................................68 13.2 Value returning remote procedures ..................................................................................................................68 13.3 Specifying exceptions.......................................................................................................................................68 13.4 14 Declaring templates................................................................................................................................69 General .............................................................................................................................................................69 14.0 Declaring message templates ...........................................................................................................................70 14.1 General........................................................................................................................................................70 14.1.0 Templates for sending messages.................................................................................................................70 14.1.1 Templates for receiving messages ..............................................................................................................70 14.1.2 Declaring signature templates ..........................................................................................................................71 14.2 General........................................................................................................................................................71 14.2.0 Templates for invoking procedures ............................................................................................................71 14.2.1 Templates for accepting procedure invocations..........................................................................................72 14.2.2 Template matching mechanisms ......................................................................................................................72 14.3 General........................................................................................................................................................72 14.3.0 Referencing elements of templates or template fields ................................................................................74 14.3.1 Referencing individual string elements.................................................................................................74 14.3.1.1 Referencing record and set fields ...................................................................................................74 14.3.1.2 Referencing record of and set of elements .................................................................................75 14.3.1.3 Parameterization of templates ..........................................................................................................................77 14.4 General........................................................................................................................................................77 14.4.0 Void..................................................................................................................................................................77 14.5 Modified templates...........................................................................................................................................77 14.6 General........................................................................................................................................................77 14.6.0 Parameterization of modified templates .....................................................................................................78 14.6.1 In-line modified templates ..........................................................................................................................79 14.6.2 Changing template fields..................................................................................................................................79 14.7 Match Operation...............................................................................................................................................79 14.8 Value of Operation ...........................................................................................................................................79 14.9 15 Operators ................................................................................................................................................80 General .............................................................................................................................................................80 15.0 Arithmetic operators.........................................................................................................................................81 15.1 String operators ................................................................................................................................................82 15.2 Relational operators..........................................................................................................................................82 15.3 ETSI
6 ETSI ES 201 873-1 V3.1.1 (2005-06) 15.4 15.5 15.6 15.7 16 16.1 16.1.0 16.1.1 16.1.2 16.1.3 16.1.4 16.2 16.2.0 16.2.1 16.2.2 16.2.2.0 16.2.2.1 16.2.3 16.3 Logical operators..............................................................................................................................................83 Bitwise operators..............................................................................................................................................83 Shift operators ..................................................................................................................................................84 Rotate operators................................................................................................................................................85 Functions and altsteps ............................................................................................................................86 Functions ..........................................................................................................................................................86 General........................................................................................................................................................86 Parameterization of functions .....................................................................................................................87 Invoking functions ......................................................................................................................................87 Predefined functions ...................................................................................................................................88 Restrictions for functions called from specific places ................................................................................89 Altsteps.............................................................................................................................................................90 General........................................................................................................................................................90 Parameterization of altsteps ........................................................................................................................90 Local definitions in altsteps ........................................................................................................................91 General..................................................................................................................................................91 Restrictions for the initialization of local definitions in altsteps ...........................................................91 Invocation of altsteps ..................................................................................................................................91 Functions and altsteps for different component types ......................................................................................92 Test cases................................................................................................................................................92 17 General .............................................................................................................................................................92 17.0 Parameterization of test cases...........................................................................................................................93 17.1 18 Overview of program statements and operations ...................................................................................93 Expressions and basic program statements ............................................................................................95 19 General .............................................................................................................................................................95 19.0 Expressions.......................................................................................................................................................96 19.1 General........................................................................................................................................................96 19.1.0 Boolean expressions ...................................................................................................................................96 19.1.1 Assignments .....................................................................................................................................................96 19.2 The Log statement ............................................................................................................................................96 19.3 The Label statement .........................................................................................................................................98 19.4 The Goto statement ..........................................................................................................................................99 19.5 The If-else statement ........................................................................................................................................99 19.6 The For statement...........................................................................................................................................100 19.7 The While statement.......................................................................................................................................100 19.8 The Do-while statement .................................................................................................................................101 19.9 The Stop execution statement.........................................................................................................................101 19.10 The Select Case statement ..............................................................................................................................101 19.11 20 Behavioural program statements ..........................................................................................................102 General ...........................................................................................................................................................102 20.0 Alternative behaviour .....................................................................................................................................103 20.1 General......................................................................................................................................................103 20.1.0 Execution of alternative behaviour ...........................................................................................................104 20.1.1 Selecting/deselecting an alternative ..........................................................................................................105 20.1.2 Else branch in alternatives ........................................................................................................................105 20.1.3 Void ..........................................................................................................................................................106 20.1.4 Re-evaluation of alt statements.................................................................................................................106 20.1.5 Invocation of altsteps as alternatives ........................................................................................................106 20.1.6 The Repeat statement .....................................................................................................................................107 20.2 Interleaved behaviour .....................................................................................................................................107 20.3 The Return statement......................................................................................................................................108 20.4 21 Default Handling ..................................................................................................................................109 General ...........................................................................................................................................................109 21.0 The default mechanism ..................................................................................................................................109 21.1 Default references...........................................................................................................................................110 21.2 The activate operation ....................................................................................................................................110 21.3 General......................................................................................................................................................110 21.3.0 Activation of parameterized altsteps.........................................................................................................111 21.3.1 ETSI
7 ETSI ES 201 873-1 V3.1.1 (2005-06) The deactivate operation ................................................................................................................................111 21.4 22 Configuration operations......................................................................................................................112 General ...........................................................................................................................................................112 22.0 The Create operation ......................................................................................................................................112 22.1 The Connect and Map operations...................................................................................................................113 22.2 General......................................................................................................................................................113 22.2.0 Consistent connections and mappings ......................................................................................................114 22.2.1 The Disconnect and Unmap operations..........................................................................................................115 22.3 The MTC, System and Self operations...........................................................................................................116 22.4 The Start test component operation ................................................................................................................116 22.5 The Stop test behaviour operation..................................................................................................................117 22.6 The Running operation...................................................................................................................................118 22.7 The Done operation........................................................................................................................................118 22.8 The Kill test component operation .................................................................................................................119 22.9 The Alive operation........................................................................................................................................120 22.10 The Killed operation.......................................................................................................................................120 22.11 Using component arrays.................................................................................................................................121 22.12 Summary of the use of any and all with components .....................................................................................121 22.13 23 Communication operations...................................................................................................................121 General ...........................................................................................................................................................121 23.0 General format of communication operations ................................................................................................122 23.1 General......................................................................................................................................................122 23.1.0 General format of the sending operations .................................................................................................122 23.1.1 General format of the receiving operations...............................................................................................123 23.1.2 Message-based communication......................................................................................................................124 23.2 General......................................................................................................................................................124 23.2.0 The Send operation ...................................................................................................................................124 23.2.1 General................................................................................................................................................124 23.2.1.0 Sending unicast, multicast or broadcast ..............................................................................................125 23.2.1.1 The Receive operation ..............................................................................................................................125 23.2.2 General................................................................................................................................................125 23.2.2.0 Receive any message...........................................................................................................................126 23.2.2.1 Receive on any port.............................................................................................................................126 23.2.2.2 The Trigger operation ...............................................................................................................................126 23.2.3 General................................................................................................................................................126 23.2.3.0 Trigger on any message ......................................................................................................................127 23.2.3.1 Trigger on any port..............................................................................................................................127 23.2.3.2 Procedure-based communication....................................................................................................................127 23.3 General......................................................................................................................................................127 23.3.0 The Call operation ....................................................................................................................................128 23.3.1 General................................................................................................................................................128 23.3.1.0 Handling responses and exceptions to a Call ......................................................................................129 23.3.1.1 Handling timeout exceptions to the Call .............................................................................................130 23.3.1.2 23.3.1.3 Calling blocking procedures without return value, out parameters, inout parameters and exceptions............................................................................................................................................130 Calling non-blocking procedures ........................................................................................................130 Unicast, multicast and broadcast calls of procedures..........................................................................131 The Getcall operation................................................................................................................................132 General................................................................................................................................................132 Accepting any call...............................................................................................................................133 Getcall on any port..............................................................................................................................133 The Reply operation..................................................................................................................................133 The Getreply operation .............................................................................................................................134 General................................................................................................................................................134 Get any reply.......................................................................................................................................134 Get a reply on any port........................................................................................................................135 The Raise operation ..................................................................................................................................135 The Catch operation..................................................................................................................................136 General................................................................................................................................................136 The Timeout exception .......................................................................................................................136 23.3.1.4 23.3.1.5 23.3.2 23.3.2.0 23.3.2.1 23.3.2.2 23.3.3 23.3.4 23.3.4.0 23.3.4.1 23.3.4.2 23.3.5 23.3.6 23.3.6.0 23.3.6.1 ETSI
8 ETSI ES 201 873-1 V3.1.1 (2005-06) 24 24.0 24.1 24.2 24.3 24.4 24.5 24.6 25 25.0 25.1 25.2 25.2.0 25.2.1 23.3.6.2 23.3.6.3 23.4 23.4.0 23.4.1 23.4.2 23.5 23.5.0 23.5.1 23.5.2 23.5.3 23.5.4 23.6 Catch any exception ............................................................................................................................137 Catch on any port ................................................................................................................................137 The Check operation ......................................................................................................................................137 General......................................................................................................................................................137 The Check any operation ..........................................................................................................................138 Check on any port.....................................................................................................................................138 Controlling communication ports...................................................................................................................138 General......................................................................................................................................................138 The Clear port operation ...........................................................................................................................138 The Start port operation ............................................................................................................................139 The Stop port operation ............................................................................................................................139 The halt port operation..............................................................................................................................139 Use of any and all with ports..........................................................................................................................140 Timer operations ..................................................................................................................................140 General ...........................................................................................................................................................140 The Start timer operation................................................................................................................................141 The Stop timer operation................................................................................................................................141 The Read timer operation ...............................................................................................................................141 The Running timer operation..........................................................................................................................142 The Timeout operation ...................................................................................................................................142 Summary of use of any and all with timers ....................................................................................................142 Test verdict operations .........................................................................................................................143 General ...........................................................................................................................................................143 Test case verdict .............................................................................................................................................143 Verdict values and overwriting rules..............................................................................................................143 General......................................................................................................................................................143 Error verdict..............................................................................................................................................144 External actions ....................................................................................................................................144 26 27 Module control part..............................................................................................................................145 General ...........................................................................................................................................................145 27.0 Execution of test cases ...................................................................................................................................145 27.1 Termination of test cases ................................................................................................................................145 27.2 Controlling execution of test cases.................................................................................................................146 27.3 Selection of Test cases ...................................................................................................................................146 27.4 Use of timers in control ..................................................................................................................................147 27.5 Specifying attributes.............................................................................................................................148 General ...........................................................................................................................................................148 Display attributes............................................................................................................................................148 Encoding of values .........................................................................................................................................148 General......................................................................................................................................................148 Encode attributes ......................................................................................................................................148 Variant attributes ......................................................................................................................................149 Special strings...........................................................................................................................................149 Invalid encodings......................................................................................................................................150 Extension attributes ........................................................................................................................................150 Scope of attributes ..........................................................................................................................................151 Overwriting rules for attributes ......................................................................................................................151 Additional overwriting rules for variant attributes....................................................................................152 Changing attributes of imported language elements.......................................................................................153 28 28.0 28.1 28.2 28.2.0 28.2.1 28.2.2 28.2.3 28.2.4 28.3 28.4 28.5 28.5.1 28.6 BNF and static semantics ............................................................................154 Annex A (normative): A.1 TTCN-3 BNF .......................................................................................................................................154 General ...........................................................................................................................................................154 A.1.0 Conventions for the syntax description ..........................................................................................................154 A.1.1 Statement terminator symbols ........................................................................................................................154 A.1.2 Identifiers .......................................................................................................................................................154 A.1.3 Comments.......................................................................................................................................................154 A.1.4 TTCN-3 terminals ..........................................................................................................................................155 A.1.5 ETSI
分享到:
收藏