1、 ETSI ES 201 873-1 V4.8.1 (2016-07) Methods for Testing and Specification (MTS); The Testing and Test Control Notation version 3; Part 1: TTCN-3 Core Language ETSI STANDARD ETSI ETSI ES 201 873-1 V4.8.1 (2016-07)2 Reference RES/MTS-201873-1 T3ed481 Keywords language, methodology, testing, TTCN-3 ETS
2、I 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 enregistre la Sous-Prfecture de Grasse (06) N 7803/88 Important notice The present document can be downloaded from: http:
3、/www.etsi.org/standards-search The present document may be made available in electronic versions and/or in print. The content of any electronic and/or print versions of the present document shall not be modified without the prior written authorization of ETSI. In case of any existing or perceived di
4、fference in contents between such versions and/or in print, the only prevailing document is the print of the Portable Document Format (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
5、change of status. Information on the current status of this and other ETSI documents is available at https:/portal.etsi.org/TB/ETSIDeliverableStatus.aspx If you find errors in the present document, please send your comment to one of the following services: https:/portal.etsi.org/People/CommiteeSuppo
6、rtStaff.aspx Copyright Notification No part may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm except as authorized by written permission of ETSI. The content of the PDF version shall not be modified without the written authoriza
7、tion of ETSI. The copyright and the foregoing restriction extend to reproduction in all media. European Telecommunications Standards Institute 2016. All rights reserved. DECTTM, PLUGTESTSTM, UMTSTMand the ETSI logo are Trade Marks of ETSI registered for the benefit of its Members. 3GPPTM and LTE are
8、 Trade Marks of ETSI registered for the benefit of its Members and of the 3GPP Organizational Partners. GSM and the GSM logo are Trade Marks registered and owned by the GSM Association. ETSI ETSI ES 201 873-1 V4.8.1 (2016-07)3 Contents Intellectual Property Rights 12g3Foreword . 12g3Modal verbs term
9、inology 12g31 Scope 13g32 References 13g32.1 Normative references 13g32.2 Informative references . 14g33 Definitions and abbreviations . 15g33.1 Definitions . 15g33.2 Abbreviations 20g34 Introduction 21g34.0 General 21g34.1 The core language and presentation formats . 21g34.2 Unanimity of the specif
10、ication 23g34.3 Conformance . 23g35 Basic language elements 23g35.0 General 23g35.1 Identifiers and keywords . 24g35.2 Scope rules 24g35.2.0 General. 24g35.2.1 Scope of formal parameters . 27g35.2.2 Uniqueness of identifiers . 27g35.3 Ordering of language elements 28g35.4 Parameterization 28g35.4.0
11、General . 28g35.4.1 Formal parameters . 29g35.4.1.0 General . 29g35.4.1.1 Formal parameters of kind value 29g35.4.1.2 Formal parameters of kind template . 32g35.4.1.3 Formal parameters of kind timer 34g35.4.1.4 Formal parameters of kind port 34g35.4.2 Actual parameters 35g35.5 Cyclic Definitions 40g
12、36 Types and values 40g36.0 General 40g36.1 Basic types and values . 41g36.1.0 Simple basic types and values 41g36.1.1 Basic string types and values . 42g36.1.1.0 General . 42g36.1.1.1 Accessing individual string elements . 44g36.1.2 Subtyping of basic types 45g36.1.2.0 General . 45g36.1.2.1 Lists o
13、f templates . 45g36.1.2.2 Lists of types 45g36.1.2.3 Ranges 46g36.1.2.4 String length restrictions 46g36.1.2.5 Pattern subtyping of character string types 47g36.1.2.6 Mixing subtyping mechanisms . 47g36.1.2.6.1 Mixing patterns, lists and ranges 47g36.1.2.6.2 Using length restriction with other const
14、raints . 48g36.2 Structured types and values . 48g36.2.0 General . 48g36.2.1 Record type and values 50g3ETSI ETSI ES 201 873-1 V4.8.1 (2016-07)4 6.2.1.0 General . 50g36.2.1.1 Referencing fields of a record type 52g36.2.1.2 Optional elements in a record. 53g36.2.1.3 Nested type definitions for field
15、types . 53g36.2.2 Set type and values 54g36.2.2.0 General . 54g36.2.2.1 Referencing fields of a set type 54g36.2.2.2 Optional elements in a set 54g36.2.2.3 Nested type definition for field types . 54g36.2.3 Records and sets of single types 54g36.2.3.0 General . 54g36.2.3.1 Nested type definitions .
16、57g36.2.3.2 Referencing elements of record of and set of types . 57g36.2.4 Enumerated type and values 58g36.2.5 Unions 60g36.2.5.0 General . 60g36.2.5.1 Referencing fields of a union type . 60g36.2.5.2 Option and union 61g36.2.5.3 Nested type definition for field types . 61g36.2.6 The anytype . 61g3
17、6.2.7 Arrays 62g36.2.8 The default type . 64g36.2.9 Communication port types . 64g36.2.10 Component types . 66g36.2.10.1 Component type definition . 66g36.2.10.2 Reuse of component types . 67g36.2.11 Component references . 69g36.2.12 Addressing entities inside the SUT 71g36.2.13 Subtyping of structu
18、red types 73g36.2.13.0 General . 73g36.2.13.1 Length subtyping of record ofs and set ofs 73g36.2.13.2 List subtyping of structured types and anytype 74g36.2.13.3 Subtyping of the iterated type of record ofs and set ofs . 76g36.2.13.4 Mixing subtyping mechanisms . 77g36.3 Type compatibility 78g36.3.0
19、 General . 78g36.3.1 Compatibility of non-structured types . 78g36.3.2 Compatibility of structured types . 79g36.3.2.0 General . 79g36.3.2.1 Compatibility of enumerated types 80g36.3.2.2 Compatibility of record and record of types 80g36.3.2.3 Compatibility of set and set of types 81g36.3.2.4 Compati
20、bility of union types 81g36.3.2.5 Compatibility of anytype types 82g36.3.2.6 Compatibility between sub-structures 82g36.3.3 Compatibility of component types . 83g36.3.4 Type compatibility of communication and connection operations 83g36.3.5 Type conversion . 84g36.4 Type synonym . 84g37 Expressions
21、. 84g37.0 General 84g37.1 Operators . 85g37.1.0 General. 85g37.1.1 Arithmetic operators 86g37.1.2 List operator . 87g37.1.3 Relational operators . 87g37.1.4 Logical operators . 90g37.1.5 Bitwise operators . 90g37.1.6 Shift operators 91g37.1.7 Rotate operators . 92g37.2 Field references and list elem
22、ents 92g3ETSI ETSI ES 201 873-1 V4.8.1 (2016-07)5 8 Modules 93g38.0 General 93g38.1 Definition of a module 93g38.2 Module definitions part . 94g38.2.0 General . 94g38.2.1 Module parameters 95g38.2.2 Groups of definitions . 96g38.2.3 Importing from modules 97g38.2.3.0 General . 97g38.2.3.1 General fo
23、rmat of import . 97g38.2.3.2 Importing single definitions . 104g38.2.3.3 Importing groups 104g38.2.3.4 Importing definitions of the same kind 105g38.2.3.5 Importing all definitions of a module . 106g38.2.3.6 Import definitions from other TTCN-3 editions and from non-TTCN-3 modules . 107g38.2.3.7 Imp
24、orting of import statements from TTCN-3 modules 109g38.2.3.8 Compatibility of language specifications in imports 110g38.2.4 Definition of friend modules 110g38.2.5 Visibility of definitions 111g38.3 Module control part . 112g39 Port types, component types and test configurations . 113g39.0 General 1
25、13g39.1 Communication ports 113g39.2 Test system interface . 116g310 Declaring constants 118g311 Declaring variables . 118g311.0 General 118g311.1 Value variables 119g311.2 Template variables 120g312 Declaring timers . 121g313 Declaring messages 122g314 Declaring procedure signatures 123g315 Declari
26、ng templates 124g315.0 General 124g315.1 Declaring message templates 125g315.2 Declaring signature templates . 126g315.3 Global and local templates 128g315.4 In-line Templates . 129g315.5 Modified templates 130g315.6 Referencing elements of templates or template fields . 133g315.6.0 General . 133g31
27、5.6.1 Referencing individual string elements 133g315.6.2 Referencing record and set fields 133g315.6.3 Referencing record of and set of elements . 134g315.6.4 Referencing signature parameters 138g315.6.5 Referencing union alternatives 138g315.7 Template matching mechanisms . 139g315.7.0 General . 13
28、9g315.7.1 Specific values . 140g315.7.2 Special symbols that can be used instead of values . 141g315.7.3 Special symbols that can be used inside values . 142g315.7.4 Special symbols which describe attributes of values . 142g315.8 Template Restrictions 143g315.9 Match Operation 145g315.10 Valueof Ope
29、ration . 147g315.11 Concatenating templates of string and list types . 147g3ETSI ETSI ES 201 873-1 V4.8.1 (2016-07)6 16 Functions, altsteps and testcases 149g316.0 General 149g316.1 Functions . 149g316.1.0 General . 149g316.1.1 Invoking functions . 151g316.1.2 Predefined functions 152g316.1.3 Extern
30、al functions 154g316.1.4 Invoking functions from specific places 155g316.2 Altsteps 156g316.2.0 General . 156g316.2.1 Invoking altsteps 157g316.3 Test cases. 159g317 Void 160g318 Overview of program statements and operations . 160g319 Basic program statements . 162g319.0 General 162g319.1 Assignment
31、s 163g319.2 The If-else statement . 164g319.3 The Select statements 165g319.3.1 The Select case statement 165g319.3.2 The Select union statement 166g319.4 The For statement 167g319.5 The While statement 168g319.6 The Do-while statement 168g319.7 The Label statement 168g319.8 The Goto statement . 169
32、g319.9 The Stop execution statement 170g319.10 The Return statement . 171g319.11 The Log statement . 172g319.12 The Break statement 173g319.13 The Continue statement . 174g319.14 Statement block . 174g320 Statement and operations for alternative behaviours 175g320.0 General 175g320.1 The snapshot me
33、chanism . 175g320.2 The Alt statement 176g320.3 The Repeat statement 180g320.4 The Interleave statement . 181g320.5 Default Handling . 183g320.5.0 General . 183g320.5.1 The default mechanism 183g320.5.2 The Activate operation . 184g320.5.3 The Deactivate operation . 185g321 Configuration Operations
34、. 185g321.0 General 185g321.1 Connection Operations 187g321.1.0 General . 187g321.1.1 The Connect and Map operations 187g321.1.2 The Disconnect and Unmap operations . 189g321.2 Test case operations. 190g321.2.0 General . 190g321.2.1 Test case stop operation . 191g321.3 Test Component Operations 191g
35、321.3.0 General . 191g321.3.1 The Create operation 191g321.3.2 The Start test component operation . 192g321.3.3 The Stop test behaviour operation . 194g321.3.4 The Kill test component operation . 195g3ETSI ETSI ES 201 873-1 V4.8.1 (2016-07)7 21.3.5 The Alive operation . 196g321.3.6 The Running opera
36、tion 197g321.3.7 The Done operation . 198g321.3.8 The Killed operation 200g321.3.9 Summary of the use of any and all with components 202g322 Communication operations. 202g322.0 General 202g322.1 The communication mechanisms 203g322.1.0 General . 203g322.1.1 Principles of message-based communication.
37、 203g322.1.2 Principles of procedure-based communication 204g322.1.3 Principles of unicast, multicast and broadcast communication 204g322.1.4 General format of communication operations . 205g322.1.4.0 General . 205g322.1.4.1 General format of the sending operations 205g322.1.4.2 General format of th
38、e receiving operations 206g322.2 Message-based communication . 207g322.2.0 General . 207g322.2.1 The Send operation 207g322.2.2 The Receive operation . 208g322.2.3 The Trigger operation 212g322.3 Procedure-based communication . 215g322.3.0 General . 215g322.3.1 The Call operation . 215g322.3.2 The G
39、etcall operation. 219g322.3.3 The Reply operation. 222g322.3.4 The Getreply operation 223g322.3.5 The Raise operation . 226g322.3.6 The Catch operation . 227g322.4 The Check operation . 230g322.5 Controlling communication ports 233g322.5.0 General . 233g322.5.1 The Clear port operation 233g322.5.2 T
40、he Start port operation . 233g322.5.3 The Stop port operation . 234g322.5.4 The Halt port operation 234g322.5.5 The Checkstate port operation . 235g322.6 Use of any and all with ports . 236g323 Timer operations 237g323.0 General 237g323.1 The timer mechanism 237g323.2 The Start timer operation . 237
41、g323.3 The Stop timer operation . 238g323.4 The Read timer operation 239g323.5 The Running timer operation. 239g323.6 The Timeout operation 240g323.7 Summary of use of any and all with timers . 241g324 Test verdict operations . 241g324.0 General 241g324.1 The Verdict mechanism . 242g324.2 The Setver
42、dict operation . 243g324.3 The Getverdict operation . 244g325 External actions 244g326 Module control . 244g326.0 General 244g326.1 The Execute statement . 245g326.2 The Control part 247g327 Specifying attributes . 249g3ETSI ETSI ES 201 873-1 V4.8.1 (2016-07)8 27.0 General 249g327.1 The Attribute me
43、chanism 249g327.1.0 General . 249g327.1.1 Scope of attributes . 249g327.1.2 Overwriting rules for attributes 250g327.1.2.0 General . 250g327.1.2.1 Additional default overwriting rules for variant attributes . 252g327.1.3 Changing attributes of imported language elements 252g327.2 The With statement
44、. 253g327.3 Display attributes . 253g327.4 Encoding attributes 254g327.5 Variant attributes . 255g327.6 Extension attributes . 257g327.7 Optional attributes . 257g3Annex A (normative): BNF and static semantics 259g3A.1 TTCN-3 BNF . 259g3A.1.0 General . 259g3A.1.1 Conventions for the syntax descripti
45、on . 259g3A.1.2 Statement terminator symbols . 259g3A.1.3 Identifiers 259g3A.1.4 Comments 260g3A.1.5 TTCN-3 terminals . 260g3A.1.5.0 General . 260g3A.1.5.1 Use of whitespaces and newlines . 262g3A.1.6 TTCN-3 syntax BNF productions . 262g3A.1.6.0 TTCN-3 module . 262g3A.1.6.1 Module definitions part 2
46、62g3A.1.6.1.0 General . 262g3A.1.6.1.1 Typedef definitions 263g3A.1.6.1.2 Constant definitions . 265g3A.1.6.1.3 Template definitions. 265g3A.1.6.1.4 Function definitions . 267g3A.1.6.1.5 Signature definitions 268g3A.1.6.1.6 Testcase definitions 268g3A.1.6.1.7 Altstep definitions 268g3A.1.6.1.8 Impor
47、t definitions . 268g3A.1.6.1.9 Group definitions . 269g3A.1.6.1.10 External function definitions 269g3A.1.6.1.11 External constant definitions 269g3A.1.6.1.12 Module parameter definitions 269g3A.1.6.1.13 Friend module definitions 269g3A.1.6.2 Control part 270g3A.1.6.3 Local definitions 270g3A.1.6.3.
48、1 Variable instantiation . 270g3A.1.6.3.2 Timer instantiation . 270g3A.1.6.4 Operations 270g3A.1.6.4.1 Component operations . 270g3A.1.6.4.2 Port operations . 271g3A.1.6.4.3 Timer operations 273g3A.1.6.4.4 Testcase operation 273g3A.1.6.5 Type . 273g3A.1.6.6 Value 274g3A.1.6.7 Parameterization 275g3A
49、.1.6.8 Statements 275g3A.1.6.8.1 With statement . 275g3A.1.6.8.2 Behaviour statements . 276g3A.1.6.8.3 Basic statements . 276g3A.1.6.9 Miscellaneous productions 279g3Annex B (normative): Matching values . 280g3ETSI ETSI ES 201 873-1 V4.8.1 (2016-07)9 B.1 Template matching mechanisms 280g3B.1.0 General 280g3B.1.1 Matching specific values . 280g3B.1.2 Matching mechanisms instead of values . 280g3B.1.2.0 General . 280g3B.1.2.1 Template list 280g3B.1.2.2 Complemented template list 281g3B.1.2.3 Any value . 282g3B.1.2.4 Any value or none 283g3B.1.2.5 Value range 283g3B.1.2.6 SuperSet