ttcn3 basics
DESCRIPTION
Ttcn3 BasicsTRANSCRIPT
![Page 1: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/1.jpg)
TTCN-3
© 2012 -TCLOUD Information Technologies Pvt Ltd
by TCLOUD Information Technologies (P) LTD
![Page 2: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/2.jpg)
Introduction to TTCN-3
� Introduction to TTCN-3
� Capabilities of TTCN-3
� Message based concepts & Procedure Based Communicat ion� Managing concurrency and parallel testing with TTCN -3� Concurrent testing configurations, communication me chanisms,
© 2012 -TCLOUD Information Technologies Pvt Ltd
� TTCN-3 test system in a nutshell� SUT, TMC, TE, TCI, TRI, SA, PA, components, ports
![Page 3: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/3.jpg)
�TTCN first saw the light of day as a fledgling language in the mid-1980s.
�Since the, it has arguably progressed to be the de facto standardized language for writing test specifications.
�some ten years later, new technologies, not least the advent of the internet and the merging of mobile and fixed telecommunications, put
Introduction : TTCN-3
© 2012 -TCLOUD Information Technologies Pvt Ltd
internet and the merging of mobile and fixed telecommunications, put pressure on TTCN to modernize. That, together with a growing perception in industry that rigorous and efficient testing was not a luxury but rather a necessity, made ETSI (European Telecommunication Standardization Institute) to decide to overhaul the original ISO/IEC TTCN specification.
�The result was TTCN-3.
![Page 4: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/4.jpg)
Introduction to TTCN -3
� Introduction to TTCN-3
� Capabilities of TTCN-3
� Message based concepts & Procedure Based Communicat ion� Managing concurrency and parallel testing with TTCN -3� Concurrent testing configurations, communication me chanisms
© 2012 -TCLOUD Information Technologies Pvt Ltd
� TTCN-3 test system in a nutshell� SUT, TMC, TE, TCI, TRI, SA, PA, components, ports
![Page 5: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/5.jpg)
To test the SUT, we need to exchange messages with it. The two most important operations to do this are the send operation and the receive operation. The send operation can be used to send a message to the SUT. The receive operation compares a received message against a template. If the message matches the template, then the message is removed from the message queue.
Message-based communication
Capabilities of TTCN -3 (1)…
testcase tc_purchaseA () runs on TVMTester {
© 2012 -TCLOUD Information Technologies Pvt Ltd
testcase tc_purchaseA () runs on TVMTester {// request the ticketpt_request.send( a_ticketA );pt_ticket.receive( a_payticket );// pay the ticketpt_cash.send( a_coin50 );pt_cash.send( a_coin100 );pt_ticket.receive( a_ticketA );setverdict( pass );};
![Page 6: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/6.jpg)
Procedure-based communication
TTCN-3 procedure-based communication is used to model the (remote) method invocation of IDL. Indeed, the procedure-based communication mechanism of TTCN-3, with the separation of in, out, and inout parameters, has been modelled on IDL to serve exactly this purpose.
Capabilities of TTCN -3 (2)...
© 2012 -TCLOUD Information Technologies Pvt Ltd
![Page 7: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/7.jpg)
Concurrent TTCN -3
� Why do we need a concurrent test architecture?
Capabilities of TTCN -3 (3)…Managing concurrency and parallel testing withTTCN -3
© 2012 -TCLOUD Information Technologies Pvt Ltd
� What kind of architectures can be used?
� How TTCN-3 supports such architectures?
� TTCN-3 Configuration Operations.
� Tips and Guidelines.
![Page 8: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/8.jpg)
Terminology� PCO Point of Control and Observation� CP Control Point (Port type)� MTC Main Test Component (Component type)� PTC Parallel Test Component (Component type)� TS Test System
Capabilities of TTCN -3 (4)…Managing concurrency and parallel testing withTTCN -3
© 2012 -TCLOUD Information Technologies Pvt Ltd
� TS Test System� TSI Test System Interface� SUT System Under Test
![Page 9: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/9.jpg)
Capabilities of TTCN -3: Managing concurrency(5)…
Why do we need a concurrent test architecture?..
� By nature, devices and users which are interfaced to the SUT are functioning in a concurrent manner.
� Even with perfectly synchronized inputs to the SUT, there are no guaranties that the SUT will reply with the exact same sequence of outputs.
© 2012 -TCLOUD Information Technologies Pvt Ltd
outputs.
![Page 10: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/10.jpg)
Capabilities of TTCN-3: Managing concurrency (6)…
Tester T1 sends the message A to the SUT
� The SUT replies to both Testers, T1 and T2
� The SUT first sends C to T2, then B to T1
� Therefore the Test Sequence is {T1!A, T2?C, T1?B}
© 2012 -TCLOUD Information Technologies Pvt Ltd
![Page 11: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/11.jpg)
Why do we need a concurrent test architecture?
� The non-deterministic behaviors of the SUT and the channel delays yield to a set of possible sequences.
- This trivial example yields to two possible outcomes.� Having this kind of alternatives would soon generate very complex non-concurrent test case descriptions.
Capabilities of TTCN-3: Managing concurrency (7)…
testcase TC_NonConcurrent_01()runs on HostYpe {
© 2012 -TCLOUD Information Technologies Pvt Ltd
T1.send(A);alt {
[ ] T1.receive(B) {T2.receive(C)
}[ ] T2.receive(C)
T1.receive(B)}}
// Other events...}
![Page 12: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/12.jpg)
Capabilities of TTCN-3: Managing concurrency (8)…
Why do we need a concurrent test architecture?
� Conformance testing:- A PBX must accept 12 simultaneous connection requests.- A railroad switching controller must compute inputs from four
detection devices and give feedback.
© 2012 -TCLOUD Information Technologies Pvt Ltd
� Service, function and feature testing:- Establish a 3-way conference.
� Stress, robustness and load testing:- System must accept 13 simultaneous Service Requests multiple
times during a sustaining period of time.
![Page 13: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/13.jpg)
Capabilities of TTCN-3: Managing concurrency (9)…
� Each tester uses different set of messages and interfaces: multiple port types.
� Each tester is different: multiple component types.
� But one port type per component type
© 2012 -TCLOUD Information Technologies Pvt Ltd
![Page 14: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/14.jpg)
Capabilities of TTCN-3: Managing concurrency (10)…
� Architecture with multiple testers of different types.
� Each tester type can have multiple kind of interfaces
© 2012 -TCLOUD Information Technologies Pvt Ltd
![Page 15: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/15.jpg)
Capabilities of TTCN-3: Managing concurrency (11)…
� The Executable Test suite can be:
-One Node - Multi-threaded (simplest, Default)-Multi-Node-Mixed
© 2012 -TCLOUD Information Technologies Pvt Ltd
![Page 16: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/16.jpg)
Capabilities of TTCN-3: Managing concurrency (12)…
Benefits with concurrent TTCN
� Less code to write� Can have several test architectures in the same test suite� Several service providers can be used.� Other components can be created at any time during
© 2012 -TCLOUD Information Technologies Pvt Ltd
� Other components can be created at any time during the test case execution.� Concurrency
- we can have several components executing simultaneously
- Several processes aiming at the same goal
![Page 17: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/17.jpg)
Introduction to TTCN-3
� Introduction to TTCN-3
� Capabilities of TTCN-3
� Message based concepts & Procedure Based Communicat ion� Managing concurrency and parallel testing with TTCN -3� Concurrent testing configurations, communication me chanisms
© 2012 -TCLOUD Information Technologies Pvt Ltd
� TTCN-3 test system in a nutshell� SUT, TMC, TE, TCI, TRI, SA, PA, components, ports
![Page 18: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/18.jpg)
TTCN-3 Test System in a nutshell (1)…
TTCN-3 specifies a test but a test system is needed for test execution
TRI and TCI standards define test system architecture
Test System Executor
Test Control
[compiled]TTCN-3 Executable
CodecsLogging
TTCN-3 Test System
TCI
TRI
© 2012 -TCLOUD Information Technologies Pvt Ltd
– TTCN- 3 tools are required to support internal interfaces
– Allows reuse of test platforms with different tools but also for different SUTs
SUT Adapter Platform Adapter
System Under Test (SUT)
TCI = TTCN-3 Control InterfaceTRI = TTCN-3 Runtime Interface
![Page 19: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/19.jpg)
An example adaptation: A IPv6 test system
Test System Executor
ParameterFile
IPv6 Codecs
ToolLogging
TTCN-3 Test System
TCI
TTCN-3 Test System in a nutshell (2)…
A test system requires:
� A TTCN-3 tool = TTCN-3 compiler and execution environment� A test platform for a specific
© 2012 -TCLOUD Information Technologies Pvt Ltd
Ethernet Adapter Real-time Adapter
Open Source FreeBSD Router
[compiled]
IPv6 ATS TTCN-3 Executable
TRI
� A test platform for a specific device under test
� Note: Tools come with default Test Control & Logging
![Page 20: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/20.jpg)
TTCN-3 Test System in a nutshell (3)…
TTCN-3 code is not executable by itself. It needs to be interpreted or translated into some executable format. TTCN-3 test system provides the following parts outside of the TTCN-3 code.
TM: Handles the overall test management by passing TTCN-3
Architecture of a TTCN-3 system
© 2012 -TCLOUD Information Technologies Pvt Ltd
management by passing TTCN-3 module parameters to the TE, and by instructing it to start and stop execution of the test cases.
CH: The CH entity enables the distribution of the TE over several devices (if required) by passing information of test case events between the distributed TEs.
![Page 21: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/21.jpg)
TTCN-3 Test System in a nutshell (4)…
CD: Responsible for encoding the message into some format that is understood by the SUT. Responsible for decoding the message from SUT into TTCN-3 value
© 2012 -TCLOUD Information Technologies Pvt Ltd
TTCN-3 value representation.
TL: The TL entity is responsible for maintaining test logs, which consists of events the TE notifies it about.
![Page 22: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/22.jpg)
TTCN-3 Test System in a nutshell (5)…TE: The TE entity corresponds to the executable code resulting from compilation or interpretation of an Abstract Test Suite (ATS), which consists one or more TTCN-3modules
SA: Handles the actual interaction with the SUT, when this is requested by the
Architecture of a TTCN-3 system
© 2012 -TCLOUD Information Technologies Pvt Ltd
the SUT, when this is requested by theTE or initiated by the SUT, and it also notifies the TE about any incoming events coming from the SUT (messages, function calls).
![Page 23: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/23.jpg)
PA: The Platform Adapter (PA) realizes the external function call statements of TTCN-3, and it provides to the TE a timer service.
TCI: Exist between the TE and TMC,and between the TE and SA
TTCN-3 Test System in a nutshell (6)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
and between the TE and SA and PA. It specifies the interface for user-implemented codecs.
TRI: Exist between TE and SA and PA. Most of the operations the interface provides are implemented by the SA and PA, and called by the TE.
![Page 24: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/24.jpg)
TTCN-3 Test System in a nutshell (7)…
Inside TTCN -3 Executable
© 2012 -TCLOUD Information Technologies Pvt Ltd
Component:•A component is a user specified entity, which contains user-defined ports.•can interact with other components and the SUT with message and procedure operations. • May contain private variables and timers. The component itself does not specify any kind of behavior but it provides an environment for it. •This means that one can start functionality in the component and this functionality can then use the ports, variables, and timers of the component.• The functionality that can be started in the component can be either a test case or a function.
![Page 25: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/25.jpg)
TTCN-3 Test System in a nutshell (8)…Inside TTCN -3 Executable
Port:• When two components want to communicate with each other, the ports of the componentshave to be first connected with each other.
© 2012 -TCLOUD Information Technologies Pvt Ltd
TSI:• Unlike the other components, one cannot start any functionality in it,• It does not have any internal variables or timers. This component acts as an abstract. •Interface between the test case and the System Under Test (SUT). •The ports of the system component (TSI) are visible to the SUT Adapter, which routes any messages or procedure operations seen at these ports between the test case components and the real test system interface at the SUT..
• When a component needs to communicatewith the SUT, its port has to be mapped with one of the ports of the TSI component
![Page 26: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/26.jpg)
TTCN-3 Executable
TTCN-3 Test System
TRI
Test Control
Codecs
Logging
TCI
InternalCommunication
PTC PTC
MTC
TTCN-3 Test System in a nutshell
Inside TTCN-3 Executable : Concurrent Test ConfigurationMTC is responsible for creating other components which are called Parallel Test Components,and for starting functionality in them.
© 2012 -TCLOUD Information Technologies Pvt Ltd
SUT Adapter Platform Adapter
System Under Test (SUT)
TRI
Implementation Under Test
All test behavior is executed on one (main) test c omponentA test involves execution of many parallel test com ponentsDynamic instantiation of components and communicati on links
![Page 27: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/27.jpg)
So…what is new in TTCN -3 and what are the TTCN -3 corner stones??
� Main new aspects& Concepts of TTCN3• Different TTCN-3 Presentation Formats• Logging Aspects
� Basic Elements of TTCN-3• Basic Language Elements
- Core Language Elements- Scoping Rules- Basic Programming Statements- Expressions- Operators & their Precedence
© 2012 -TCLOUD Information Technologies Pvt Ltd
- Operators & their Precedence- Control Transfer Statements, Module Import, Module Parameterization
• TTCN-3 Types- Basic & Structured Types- Any Type, Sub typing - Timer
� Building blocks of TTCN-3 -Type Definitions-Templates-Test Configurations-Test cases
![Page 28: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/28.jpg)
Main new aspects& Concepts of TTCN 3
TTCN can be integrated with types systems of other languages
Fully harmonized with ASN.1 (1997)TTCN-3
Core IDL Types &
XML Types &
Values
ASN.1 Types
& Values
Use of TTCN -3 With Other Languages
© 2012 -TCLOUD Information Technologies Pvt Ltd
with ASN.1 (1997)
Harmonized with other languages� IDL, XML, C/C++
Core Language
IDL Types &
Values
Other types & Values n
IDL: Integration Description Language
![Page 29: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/29.jpg)
Main new aspects& Concepts of TTCN 3
Different TTCN-3 Presentation FormatsThe Core Language and Other Presentation Formats
TTCN-3
Text format
Tabular
Format
Core format is text based (most popular)
TTCN-3 can be edited or viewed in other formats
� Tabular format
© 2012 -TCLOUD Information Technologies Pvt Ltd
TTCN-3 Core Language Presentation
Format 3
PresentationFormat n
Graphical Format
� Tabular format (for TTCN-2 people)
� Graphical format (good for visual overview)
� Other standardized formats in the future?
� Proprietary formats possible
![Page 30: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/30.jpg)
Main new aspects & Concepts of TTCN 3
testcase TC_resolveTCLOUDWww() runs on DnsClient{
timer t_ack;serverPort.send(m_dnsQuestion("www.tcloudtech.com"));t_ack.start(1.0);alt {
[] serverPort.receive(mw_dnsAnswer("176.136.72.81")) {
setverdict (pass);}
Different TTCN-3 Presentation Formats: Example Core (Text) Format
© 2012 -TCLOUD Information Technologies Pvt Ltd
}
[] serverPort.receive { // any other messagesetverdict(fail);}
[] t_ack.timeout {setverdict(inconc);
}
}t_ack.stop;
}
![Page 31: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/31.jpg)
Main new aspects& Concepts of TTCN 3
Different TTCN-3 Presentation Formats Example Grap hical Format
testcase TC_resolveTCLOUDWww() runs on DnsClient
DnsClient
mtc
DnsPort
serverPort
m_dnsQuestion("www.tcloudtech.com")
timer t_ack
t_ack
© 2012 -TCLOUD Information Technologies Pvt Ltd
m_dnsQuestion("www.tcloudtech.com")t_ack
altmw_dnsAnswer("176.136.72.81")
?
t_ack
inconc
fail
pass
t_ack
![Page 32: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/32.jpg)
Main new aspects& Concepts of TTCN 3Different TTCN-3 Presentation Formats Example Tabu lar Format
Testcase
Name TC_resolveTCLOUDWww()
Group
Purpose
System Interface
MTC Type DnsClient
Comments
Local Def Name Type Initial value Comments
t_ack timer
© 2012 -TCLOUD Information Technologies Pvt Ltd
t_ack timer
Behavior
serverPort.send(m_dnsQuestion("www.tcloudtech.com"));
t_ack.start(1.0);
alt {
[] serverPort.receive(mw_dnsAnswer("176.136.72.81")) { setverdict (pass); }
[] serverPort.receive // any other message{ setverdict(fail); }
[] t_ack.timeout{ setverdict(inconc); }
}
t_ack.stop;
Detailed Comments:
![Page 33: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/33.jpg)
Main new aspects& Concepts of TTCN 3
� Logging Aspects
It is allowed to use in a user log statement• literal values (incl. charstrings -> the only logged item in v.2.2.1)• module parameter values• constant (TTCN-3, ASN.1 or external) values.• templates.• variable values.• component instance actual values and names.
© 2012 -TCLOUD Information Technologies Pvt Ltd
• component instance actual values and names.• component states (running & alive).• port states.• timer states and elapsed time.• default reference values (incl. 'UNITIALIZED' ).• function return values (TTCN-3 or external).• formal parameter values.
![Page 34: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/34.jpg)
Main new aspects& Concepts of TTCN3
� Main new aspects& Concepts of TTCN3• Triple C, Module concept, Extendibility• Different TTCN-3 Presentation Formats• Logging Aspects
� Basic Elements of TTCN-3• Basic Language Elements
- Core Language Elements- Scoping Rules- Basic Programming Statements- Expressions
© 2012 -TCLOUD Information Technologies Pvt Ltd
- Expressions- Operators & their Precedence- Control Transfer Statements, Module Import, Module Parameterization
• TTCN-3 Types- Basic & Structured Types- Any Type, Sub typing - Timer
� Building blocks of TTCN-3 -Type Definitions-Templates-Test Configurations-Test cases
![Page 35: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/35.jpg)
Basic Elements of TTCN -3: Basic Language Elements
Core Language Elements(1)
• Keywords per language element• TTCN-3 module definition: module• Import of definitions from other module: import• Grouping of definitions: group• Data type definition: type• Communication port definitions: port• Test component definitions: component• Signature definitions: signature
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Signature definitions: signature• External function/constant definitions: external• Constant definitions: const• Data/signature template definitions: template• Function definitions: function• Alt step definitions: altstep• Test case definitions: test case• Variable declarations: var• Timer declarations: timer
• Keywords are written in all lowercase letters
![Page 36: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/36.jpg)
Core Language Elements(2)
�Generally, the order in which declarations can be m ade is arbitrary
� Identifiers• Start with a letter• Can contain digits and underscores• Are case sensitive
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Are case sensitive
� Comments• as free text• may appear anywhere in a TTCN-3 specification module• Nested comments are not allowed
![Page 37: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/37.jpg)
Scoping Rules
� Six scope units• Module definition part• Control part• Component types• Functions• Alt steps• Test cases
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Test cases• “Blocks of statements and declarations”
� Each scope unit can have declarations (optional)
![Page 38: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/38.jpg)
Basic Program Statements
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
�Label/goto construct can only be used in alternativ es
�{ } can not be omitted
![Page 39: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/39.jpg)
� Expressions are only allowed for compatible types
� They are read left to right, respecting parenthesis
Expressions
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
� Boolean expression can only contain boolean values or boolean expressions
�There are no prefix or postfix operations (like C: i++;)
![Page 40: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/40.jpg)
Operations ...(1)
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
![Page 41: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/41.jpg)
Operations ... (2)
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
![Page 42: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/42.jpg)
And their precedence ...
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
![Page 43: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/43.jpg)
Operation: Bit oriented
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
�Bitwise operators• Operands can be of compatible type
• bitstring• hexstring• octetstring
• Operands must have the same compatible type and the same length�Shift and rotate operators
• Right hand operand must be an Integer (expression)
![Page 44: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/44.jpg)
�Labels can be declared everywhere except as a top a lternative in a alt or interleave statement
�Label identifiers shall be unique in their scope• Example
label MyLabel;i := i +1;
Label / Goto
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
i := i +1;label L01;goto MyLabel;
� Goto can be used to jump forward and backward in one fun ction, but not into an alt, interleave while, for statement, e tc.
� DON’T USE IT! (“Why goto’s are considered harmful”)
![Page 45: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/45.jpg)
�Grammar ruleif “(“ BooleanExpression “)”StatementBlockElseIfClause[ElseClause]ElseIfClause := else if “(“ BooleanExpression “)” StatementBlockElseClause := else StatementBlock
Control Flow: The if-clause
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
�{ } are mandatory!
�Exampleif (i>5) {x(7) ;} else if (i<5) {y(9) ;} else { return ;}
![Page 46: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/46.jpg)
�Grammar rule• for “(“ Initial ; Final ; Step “)” StatementBlock• Initial := VarInstance / Assignment• Final := BooleanExpression• Step := Assignment
�Examplefor ( var integer i:=0; i<10; i:= i + 1) {y:=i;}
Control Flow: The for clause
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
}
Control Flow: The while clause�Grammar rule
while “(“ BooleanExpression “)” {StatementBlock }
�BooleanExpression will be evaluated before entering the Statement Block.�{ } are mandatory!!!� Example
while (i<10) {i := i + 1;}
![Page 47: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/47.jpg)
� Grammar ruledo { StatementBlock } while “(“ BooleanExpression “)”
� BooleanExpression will be evaluated after execution of theStatementBlock.
� { } are mandatory!!!
Control Flow: do-while-clause
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
� Exampledo {i := i + 1;} while (i<10)
activate, deactivate, stop, repeat and return
Other Control transfer statements
![Page 48: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/48.jpg)
Groups in TTCN -3
• TTCN-3 groups are a way to organize data
• Limited functionality• No scope unit• In TTCN-3 specification only importing is specified
• Group identifiers have their own scoping rules
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Group identifiers have their own scoping rules• Group identifiers can be reused
• Examplegroup G1 {group Valid {...}}group G2 {group Valid {...}}
![Page 49: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/49.jpg)
Module Import
�Import of� Single definition
import from MyModuleC {type MyType;}� All definitions
import from MyModule all;� Groups
import from MyModule {group Valid;}� Definitions of the same kind
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
� Definitions of the same kindimport from MyModule {template all;}
� Definitions of the foreign languageimport from MyModule language “ASN.1:1997” all;
� Mixtureimport from MyModule {type MyType, OtherType; template all;}
� Import is by default nonrecursive� Name clashes are handled with module name prefixes
![Page 50: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/50.jpg)
Module Parameterization
� Needed for parameterization at runtime
� Module Parameters• Several test system installations
• Different access data to SUT• Different capabilities/versions of SUT
• Do not execute irrelevant test cases• Provide data when starting test system
Basic Elements of TTCN -3: Basic Language Elements
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Provide data when starting test system• No hardcoding into constants to avoid recompilation
• modulepar {charstring mp_nameServerHost:=
"localhost";integer mp_nameServerPort := 2000}
� External Constants•Similar concept but without default value external const integer port No;
![Page 51: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/51.jpg)
Main new aspects& Concepts of TTCN3
� Main new aspects& Concepts of TTCN3• Triple C, Module concept, Extendibility• Different TTCN-3 Presentation Formats• Logging Aspects
� Basic Elements of TTCN-3• Basic Language Elements
- Core Language Elements- Scoping Rules- Basic Programming Statements- Expressions
© 2012 -TCLOUD Information Technologies Pvt Ltd
- Expressions- Operators & their Precedence- Control Transfer Statements, Module Import, Module Parameterization
• TTCN-3 Types- Basic & Structured Types- Any Type, Sub typing - Timer
� Building blocks of TTCN-3 -Type Definitions-Templates-Test Configurations-Test cases
![Page 52: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/52.jpg)
TTCN-3 Types
� Basic Types(1)• Boolean type
Boolean : true, false
• Integer type
Integer : unrestricted range
Example: -5,0,33445555
• Float type
© 2012 -TCLOUD Information Technologies Pvt Ltd
Float : unrestricted range
Example: -5.3,0.3,0.34E-1
•Char type
Char : A single character according to ISO/IEC 646
Example: “a”,”0”
• Universal Char type
Universal Char type: A single character according to ISO/IEC 10646
Example: “a”, char(0,0,1,113)
![Page 53: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/53.jpg)
TTCN-3 Types
� Basic Types(2)
�Octet string type
Octet string : a sequnce of octets
Example: ‘AAF09E’O,’00FF’O
�Hex string type
Hex string : a sequnce of hexdigits
© 2012 -TCLOUD Information Technologies Pvt Ltd
Hex string : a sequnce of hexdigits
Example: ‘AAF09E’H,’0FF’H
�Bit string type
Bit string : a sequence of bits
Example: ‘1101’,’0110’
Contd…..
![Page 54: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/54.jpg)
� (Universal) Char string type[Universal] Char string : a sequence of charsExample : ”Hello”, “Hell” & char(0,0,0,46)
� Verdict TypeVerdict Type: a type for test verdictsExample : pass, fail, inconc
� Basic Types(3)
TTCN-3 Types
© 2012 -TCLOUD Information Technologies Pvt Ltd
Example : pass, fail, inconc
![Page 55: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/55.jpg)
type record url {charstring protocol,charstring host,charstring file}
type set of dinosaur dinolist;
� Structured Type Definition
TTCN-3 Types
© 2012 -TCLOUD Information Technologies Pvt Ltd
type set of dinosaur dinolist;
type record dinosaur { charstring name,integer len,integer mass optional,charstring time,charstring place}
![Page 56: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/56.jpg)
� Relevant TTCN-3 Definitions
type set of dinosaur dinolist ;type record dinosaur {charstring name,charstring len,charstring mass ,charstring time ,charstring place}type record url {charstring protocol ,
TTCN-3 Types
© 2012 -TCLOUD Information Technologies Pvt Ltd
charstring protocol ,charstring host ,charstring file}template url requestURL := {protocol := " http://",host := " www.tcloudtech.com ",file := " /TTCN-3_Example/dinolist.xml "}type port httpTestPortType message {out url ;in dinolist ;}
![Page 57: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/57.jpg)
Types : record, record of, set, set of, union, enumeratedCan be nested into: record, record of, set, set of, union
type record MyRecord {
union {integer choice1,octetstring choice2
� Nested structured type definitions
TTCN-3 Types
© 2012 -TCLOUD Information Technologies Pvt Ltd
octetstring choice2} field1,
enumerated {Rose, lotus, lilli
} field2,integer field3 (0..31)
};
const MyRecord.field1 := { choice2 := '80'O };
![Page 58: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/58.jpg)
� Any type
TTCN-3 Types
�Models a union of all known types in a TTCN-3 module
Var anytype MyVarOne, MyVarTwo;
Var integer MyVarThree;
MyVarOne.integer :=34;
MyVarTwo:={integer :=Myvarone+1};
© 2012 -TCLOUD Information Technologies Pvt Ltd
MyVarTwo:={integer :=Myvarone+1};
MyVarThree;=MyVarOne X 12;
�DON’T USE THIS!
![Page 59: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/59.jpg)
� Basic and Structured types can be sub typed
TTCN-3 Types
© 2012 -TCLOUD Information Technologies Pvt Ltd
![Page 60: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/60.jpg)
� Sub typing : Examples
TTCN-3 Types
�Sub typing of simple types
• type integer Byte (0….255)
• type integer odd (1,3,5,7,9)
• type octet string Buffer length (2…5)
© 2012 -TCLOUD Information Technologies Pvt Ltd
• type octet string Buffer length (2…5)
• type char string Identifier (“a”..”z”,”A”…”Z”)
�Sub typing of Structured elements
• Type record length(10) of integer MyRecord OfType
• Type record length(0….10) of charstring stringarrey length(12);
![Page 61: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/61.jpg)
� Sub typing : Examples
TTCN-3 Types
�Type compatibility is required for assignements, comparison and instantiation
�Enumerated are only compatible to themselves strong typing)
�Basic types: the value “b” is compatible to type “A “ if
© 2012 -TCLOUD Information Technologies Pvt Ltd
�Basic types: the value “b” is compatible to type “A “ if type “B” resolves to the same root type as type “A” and it does not violate subtyping (eg. Ranges, length restrictions) of type “A”.
Example: type integer A(0,…256);
type integer B(10……256);
Var B myB :=b:
![Page 62: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/62.jpg)
• Timers are used to observe time progress
• Timers can be declared and used• local in control part, testcases, functions and altesteps• additionaly component wide in component type definition
• Timer values are floats, its unit are seconds
• Examples of timer declaration• timer t1 := 1.0 ; // default value one second
TTCN-3 Timers
© 2012 -TCLOUD Information Technologies Pvt Ltd
• timer t1 := 1.0 ; // default value one second• timer t2 := 0.010 ; // default value of ten milliseconds• timer t3 := 1E-2 ; // using alt float notation
• Examples of timer operations• t1.start(5.5) ; // overriding any default value• t2.stop ;• boolean b := t1.running ;• float f := t2.read ;• t3.timeout ;
![Page 63: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/63.jpg)
Main new aspects& Concepts of TTCN3
� Main new aspects& Concepts of TTCN3• Triple C, Module concept, Extendibility• Different TTCN-3 Presentation Formats• Logging Aspects
� Basic Elements of TTCN-3• Basic Language Elements
- Core Language Elements- Scoping Rules- Basic Programming Statements- Expressions
© 2012 -TCLOUD Information Technologies Pvt Ltd
- Expressions- Operators & their Precedences- Control Transfer Statements, Module Import, Module Parameterization
• TTCN-3 Types- Basic & Structured Types- Any Type, Sub typing - Timer
� Building blocks of TTCN-3 -Type Definitions-Templates-Test Configurations-Test cases
![Page 64: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/64.jpg)
Building blocks of TTCN -3 Module (1)…
� Type definition (Definition of different types used in the message)
� Templates (test data description) and matching mechanisms(pattern matching)
� Test configurations• Formally defined interfaces to the SUT• Dynamic creation of test component
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Dynamic creation of test component• Concurrency to describe distributed test setups
� Test cases• Small (complete) separate compileable programs• Share (type and data) information
� Test verdicts
![Page 65: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/65.jpg)
Structured Definitions Part
module TcloudDnsTests{
group MessageStructure{
// Defintions of message types}
Building blocks of TTCN -3 Module (2)…
� TTCN3 Module
© 2012 -TCLOUD Information Technologies Pvt Ltd
}group TestData{
// Templates for messages instances}group TestSystemConfiguration{
// Port and component types and mappings}group TestCases{
// Test case definitions}
}
![Page 66: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/66.jpg)
� TTCN3 Modulemodule TcloudDnsTests{
// Test definition part
control{
// Test execution part// (optional)
Module (…)
Module Definitions
Building blocks of TTCN -3 Module (3)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
// (optional)}
}Module Control
module TcloudDnsTests{
// Message structure// Actual test data// Test configuration// Test Case definitio
}
Definitions Part
![Page 67: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/67.jpg)
� TTCN3 Module
Module (…)
Module Definitions
module TcloudDnsTests{
// Test definition partmodulepar boolean mp_example;
testcase TC_resolveTCLOUDWww() runs on DnsClient{
Control Part
Building blocks of TTCN -3 Module (4)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
Module Control
Definitions // .. as in previous slide}
// Test execution partcontrol {if (mp_example) {
execute(TC_resolveTCLOUDWww());}
}}
Control Part
![Page 68: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/68.jpg)
� TTCN3 Module Definition Continued..
�Module Definitions
•Type Definitions
•Templates
•Port Definitions
type record DNSQuery {
charstring hostname,
AnswerType answer optional ,
QueryType qtype
}
Building blocks of TTCN -3 Module (5)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
•Component Definitions
•Test case
•Control Part
�Module Control
type union AnswerType {
Byte address[4],
charstring hostname}
type integer Byte (0 .. 255);
type enumeration QueryType {
}A, NS, CNAME
![Page 69: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/69.jpg)
� Module Definitions
•Type Definitions
•Templates
•Port Definitions
template DNSQuery query {
host name :=“ www.tcloudtech.com ”; answer := omit ; qtype := A;
}
� TTCN3 Module Definition Continued..
Building blocks of TTCN -3 Module (6)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
•Component Definitions
•Test case
•Control Part
�Module Control
}
template DNSQuery response modifiesquery {
answer.address := {176,136,72,81};
}
![Page 70: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/70.jpg)
• Templates• Basic and Parameterized Templates• Modified and Inline Templates• Matching
Examples of Send Templates
• Template of basic type
�Template Details
Building blocks of TTCN -3 Module (7)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Template of basic typetemplate integer i := 1 ;template octetstring o := 'AABBCC'O
• Template of structured typestemplate MyRecord r := {fieldA := omit, // must be declared optionalfieldB := 1,fieldC := f(4) }template MyUnion u := {integerVariant := 4 }
![Page 71: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/71.jpg)
Examples of Receive Templates
• Template of basic typetemplate integer i := ? ;template octet string o := 'AA??CC'Otemplate integer i := 1 ;template integer i := (1, 2, 4..5) ;
�Template Details continued
Building blocks of TTCN -3 Module (8)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Template of structured typestemplate MyRecord r := {
fieldA := *, // must be declared optionalfieldB := ?,fieldC := pattern “ab*z” }
template MyUnion u := {integerVariant := 2 }
![Page 72: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/72.jpg)
• Elements that can have templates as parameters• Function• Testcase• Altstep
Parameterization of Templates
�Template Details continued
Building blocks of TTCN -3 Module (10)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Altstep• Template
function f2(template MyRecord r1)runs on C {p1.send(r1) ;}
![Page 73: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/73.jpg)
Parameterization of Templates
• Parameterization with values• template MyRecord r2(integer i) := {integerField1 := i,integerField2 := i+2,charstringField := ””"Hello””"}
�Template Details continued
Building blocks of TTCN -3 Module (9)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
charstringField := ””"Hello””"}
• Parameterization with templates• To enable passing of wildcards and other matching operations
• template MyRecord r2(template SubRecord r1) := {aRecordField := r1,charstringField := ””"Hello”"" }
![Page 74: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/74.jpg)
Modifications of Templates
• Parameterization is applicable
• Example// Giventemplate MyRecordType MyTemplate1(integer i) := {
�Template Details continued
Building blocks of TTCN -3 Module (11)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
field1 := i,field2 := "A string",field3 := true}
// then writingtemplate MyRecordType MyTemplate2(integer i)
modifies MyTemplate1 := {// field1 remains parameterizedfield2 := "A modified string"// field3 is unchanged }
![Page 75: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/75.jpg)
Implicit (Inline) Templates
• Named templates vs. unnamed templates
• Unnamed, so called inline templates reduce amount o f template definitions
• Especially in combination with modifies
�Template Details continued
Building blocks of TTCN -3 Module (12)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Especially in combination with modifies
• Might enhance readability, but handle with care
• Example:template MyRecord r1 := {
fieldA1 := { fieldB1:= 2, fieldB2 := "test" },fieldA2 := 2}
![Page 76: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/76.jpg)
Matching Operations
• Group 1: Specific Values• expression that resolves to a single value• omit
• Group 2 : Instead of Values• ? wildcard for any value• * wildcard for any value or no value at all
Building blocks of TTCN -3 Module (13)
�Template Details continued
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Group 3: Special Symbols inside values• ? wildcard for any single element of a string, array, record of, and set of• * wildcard for any number of consecutive elements of a string, array,record of, and set of
• Group 4: Unspecific Values• length: restriction on length of strings and of number of elements of array, record of, and set of• ifpresent: for matching optional field values
![Page 77: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/77.jpg)
Basic Elements of TTCN -3 Module (1)…
�Test system configuration
type port DNSPort message {
inout DNSQuery;
// a port may send/receive messages
// of more than one type}
// Port Definition� Module Definitions
•Type Definitions
•Templates
•Test system configuration
•Port Definitions
© 2012 -TCLOUD Information Technologies Pvt Ltd
}
type component DNSTester {
port DNSPort P;
// a component may have more than
one port}
// Component Definition
PDNSTesterDNSQuery
•Port Definitions
•Component Definitions
•Test case
� Module Control
![Page 78: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/78.jpg)
Basic Elements of TTCN -3 (2)…
TTCN3 Module Definition Continued… Test Case
testcase Testcase1() runs on DNSTester {
P.send(query);
P.receive(response);
setverdict(pass);
stop;}
� Module Definitions
•Type Definitions
•Templates
•Test system configuration
© 2012 -TCLOUD Information Technologies Pvt Ltd
Client
(“www.tcloudtech.com”,A)
(“www.tcloudtech.com”, 176.136.72.81 ,A)
DNS
Pass
•Port Definitions
•Component Definitions
•Test case
� Module Control
![Page 79: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/79.jpg)
Basic Elements of TTCN -3 (3)…
TTCN3 Module Definition Continued… : Control part
�Controls the execution of the test case
control {
execute (Testcase1());
� Module Definitions
•Type Definitions
•Templates
•Test system configuration
© 2012 -TCLOUD Information Technologies Pvt Ltd
// more test cases might follow
}
•Test system configuration
•Port Definitions
•Component Definitions
•Test case
� Module Control
![Page 80: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/80.jpg)
�Introduction to Test Data type, Actual test data, Test Configuration,- Test component, Communication ports, Functions, Test Behavior - Control and monitor component - How TTCN-3 supports concurrent architectures- Behavior alternative
� Foreign data (ASN.1) usage in TTCN -3
Building blocks of TTCN -3 test suite
© 2012 -TCLOUD Information Technologies Pvt Ltd
� Foreign data (ASN.1) usage in TTCN -3- Goal, Overview, ASN.1 to TTCN-3 mapping, Conventions,ASN.1/
TTCN-3 type equivalence, Open Type, Other String Types, Structured Types, ASN.1 values, Modules
![Page 81: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/81.jpg)
Building blocks of a TTCN -3 Test Suite (1)…
Test Suite
Test Data Types
Data types which specify• Structure of messages or calls and theirStructure of messages or calls and theirStructure of messages or calls and theirStructure of messages or calls and their
information elements (fields, parameters)information elements (fields, parameters)information elements (fields, parameters)information elements (fields, parameters)• Internal data structures (e.g., for computation)Internal data structures (e.g., for computation)Internal data structures (e.g., for computation)Internal data structures (e.g., for computation)• Possibly encoding or display informationPossibly encoding or display informationPossibly encoding or display informationPossibly encoding or display informationBuilt-in basic typesinteger, boolean, float,integer, boolean, float,integer, boolean, float,integer, boolean, float,bitstring, hexstring, octetstring,bitstring, hexstring, octetstring,bitstring, hexstring, octetstring,bitstring, hexstring, octetstring,
© 2012 -TCLOUD Information Technologies Pvt Ltd
bitstring, hexstring, octetstring,bitstring, hexstring, octetstring,bitstring, hexstring, octetstring,bitstring, hexstring, octetstring,charstring, universal charstringcharstring, universal charstringcharstring, universal charstringcharstring, universal charstring... and structured typesrecord, record of, set, set ofrecord, record of, set, set ofrecord, record of, set, set ofrecord, record of, set, set ofunion, enumeratedunion, enumeratedunion, enumeratedunion, enumerated... and special types such ascomponent, port, verdict type, default, etc component, port, verdict type, default, etc component, port, verdict type, default, etc component, port, verdict type, default, etc
![Page 82: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/82.jpg)
Building blocks of a TTCN -3 Test Suite (2)…
Test Suite
Actual Test Data
Test Data Types
Actual test data (values) used during testing• Constants or Templates for specific
message or call parameter values• Matching expressions for allowing multiple
message or call parameter values• value range, value list, wildcards,
presence, length, size, permutation
© 2012 -TCLOUD Information Technologies Pvt Ltd
presence, length, size, permutation• regular expressions
• Using also template decomposition,parameterization and modification
![Page 83: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/83.jpg)
Test Data Definitions• Templates define the test data• Are based on basic or structured types
• Send templates, contain only concrete values and no matching operations
• Receive templates can contain
Building blocks of a TTCN -3 Test Suite (3)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Receive templates can contain• Wildcards• Matching operations
![Page 84: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/84.jpg)
Building blocks of a TTCN -3 Test Suite (4)…
Test Suite
Actual Test Data
Test Data Types
Static aspects
• Test component and port types
Dynamic aspects
• Dynamic instantiation andmanagement of test components
• Mappings of test components to
© 2012 -TCLOUD Information Technologies Pvt Ltd
Test Configuration
Test Data • Mappings of test components toabstract test system interfaces
• Connections between testcomponent interfaces
• Management of test components
![Page 85: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/85.jpg)
Test Suite
Actual Test Data
Test Data Types
test cases
• specify sending/receiving messages,computation (e.g., checksums), and verdict assignment
• can be decomposed with functions andaltsteps
• can (re)use default behavior
Building blocks of a TTCN -3 Test Suite (5)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
Test Behaviour
Test Configuration
• can (re)use default behavior
• can use timers and timeouts
test execution control (optional)• order, repetition, conditions, etc
![Page 86: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/86.jpg)
TTCN-3 functions define the behavior of the parallel testcomponents function root_behaviour runs on DNSTester {
alt {
[ ] P.receive (rootquery) {
P.Send(rootanswer);
setverdict (pass );
}
DNS Root NS
(“tcloudtech.com”, NS)alt
Parallel Test Component
Building blocks of a TTCN -3 Test Suite (6)…
© 2012 -TCLOUD Information Technologies Pvt Ltd
}
[ ] P. receive { setverdict (fail );
}
}
stop ;
}
(“tcloudtech.com”, “ns.tcloudtech.com”, NS)
Pass
fail
![Page 87: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/87.jpg)
� Test Verdicts� Type verdicttype
• 5 values: none, pass, inconc, fail, error• error: set by runtime system
� Each component maintains a verdict• Initial value: none
• setverdict ( …) to change verdict
Building blocks of a TTCN -3 Test Suite (6)...
© 2012 -TCLOUD Information Technologies Pvt Ltd
• setverdict ( …) to change verdict• getverdict to read verdict
• Verdict cannot be improved• setverdict ( fail ) ;• setverdict ( pass) ;• getverdict; // --> fail
� Overall verdict: minimum of testcomponent verdicts
![Page 88: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/88.jpg)
• Several components in a test configuration• Always: Main Test Component, Test System Interface
• Main Test Component• Reference: mtc• Created when test case execution starts
Building blocks of a TTCN -3 Test Suite
� Special Components
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Test system interface• Reference: system• Created when test case execution starts• Defines ports to communicate with SUT• May contain timers, etc.
• Initially: one test component, mtc and system coincide
• Later: access to timers, etc., dynamic test configurations
![Page 89: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/89.jpg)
var DNSTester RootComp, NSComp, ClientComp;
RootComp := DNSTester. create ;
NSComp := DNSTester. create ;
ClientComp := DNSTester. create ;
map(RootComp:P, system :ROOT);
testcase Testcase3() runs on mtc
system TSI {
Building blocks of a TTCN -3 Test SuiteDynamic Configuration
© 2012 -TCLOUD Information Technologies Pvt Ltd
map(NSComp:P, system :NS);
map(ClientComp:P, system :CLIENT)
RootComp. start (RootBehaviour());
NSComp. start (NSBehaviour());
ClientComp. start (ClientBehaviour());
ClientComp. done ;
// block until ClientComp is donestop ;
}
![Page 90: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/90.jpg)
How TTCN-3 supports concurrent architectures?� Dynamic creation of the test configuration
- Creation of components• create
� Creation of connections between Components• map, unmap
� Creation of connections with the TSI/SUT• connect, disconnect
� Dynamic control of the component behavior
Building blocks of a TTCN -3 Test Suite
© 2012 -TCLOUD Information Technologies Pvt Ltd
� Dynamic control of the component behavior- Control of component behavior
• start, stop, kill- Lookup of component behavior
• running, done, alive, killed
� Communication between components- Exchange of messages between components
send, receive- Implicit verdict mechanism
setverdict, getverdictnone, pass, inconc, fail, error
![Page 91: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/91.jpg)
Testing Concept : Self-test of Test Cases� Use concurrency to perform a self-test of a test case
- All behavior is encapsulated in a function. In the normal case, this function is simply called in the MTC.
Building blocks of a TTCN -3 Test Suite
© 2012 -TCLOUD Information Technologies Pvt Ltd
-For Self-Testing, a simulation of each of the SUT port is implemented in one or more Parallel Test Components (PTCs). They are connected to MTC ports.
- Since the Test System Interface can be left empty, SUT Adaptation is not needed for the self-test test suite.
![Page 92: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/92.jpg)
Building blocks of a TTCN -3 Test Suite
• Everything that “pure” functions are, plus• Runs-on clause defining the component type the func tion can beexecuted only• Port parameters possible• Templates as parameters, can only be in
• Examples• Runs -on clause
Behaviour Functions
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Runs -on clausefunction f() runs on C return integer {p.send (SomeTemplate) ;return 1;}
• Template parametersfunction f(template R myRecord) runs on C {p.send (myRecord) ;}
![Page 93: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/93.jpg)
• Use runs on to access component entities• Timers, ports, constants, variables
type component AddressBookClient {port ServerPort pt_server;const float c_maxDuration := 2.0;… ;
Building blocks of a TTCN -3 Test Suite
Functions on Components
© 2012 -TCLOUD Information Technologies Pvt Ltd
… ;}
function f_addEntry (in Entry p_entry )runs on AddressBookClient{
pt_server. send ( … );pt_server. receive ( … ) { … };
}
![Page 94: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/94.jpg)
function f_startup() runs on MyComp{/* A new component of type SomeComp is created, and a reference to this* component is stored into variable cp_someCompRef. */var SomeComp cp_someCompRef := SomeComp.create;/* Local port pt_control is connected with the port pt_ctrl* of the newly created component. */connect(self:pt_control, cp_someCompRef:pt_ctrl);/* Port pt_data of the newly created component is m apped* with the port tcp of the test system interface co mponent.*/
Building blocks of a TTCN -3 Test Suite
Functions on Components: Example
© 2012 -TCLOUD Information Technologies Pvt Ltd
*/map(cp_someCompRef:pt_data, system:pt_tcp);/* Function tp_someBehaviour() is started in the co mponent,* and string "10.10.10.1" is given to it as a param eter.* .start() is a non blocking command, so the execut ion continues* immediately after the below statement.*/cp_someCompRef.start(tp_someBehaviour("10.10.10.1") );// Wait for cp_someCompRef to finish its execution.cp_someCompRef.done;// Set own verdict to pass.setverdict(pass);// Stop own execution.self.stop}
![Page 95: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/95.jpg)
�Introduction to Test Data type, Actual test data, Test Configuration,- Test component, Communication ports, - Functions, Test Behavior - Control and monitor component - How TTCN-3 supports concurrent architectures- Behavior alternative
Building blocks of TTCN -3 test suite
© 2012 -TCLOUD Information Technologies Pvt Ltd
� Foreign data (ASN.1) usage in TTCN-3- Goal, Overview, ASN.1 to TTCN-3 mapping, Conventions,ASN.1/ TTCN-3
type equivalence, Open Type, Other String Types, Structured Types, ASN.1 values, Modules
![Page 96: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/96.jpg)
Behavior alternative : alt statement & altstep
Alt Statement: Alt statement allows to group several block operations into a single statement.It is also possible to have an alt statement with only a single alternative.The alt statement specifies a list of receiving operations: receive, getcall, getreply, catch trigger and check, done and timeout. The "done" operation blocks the execution of calling component, until the specified other component has finished its function execution.
Altstep: In TTCN-3, altstep is similar to function in that they can have parameters, but unlike functions, they also allow the description of guard
© 2012 -TCLOUD Information Technologies Pvt Ltd
parameters, but unlike functions, they also allow the description of guard expressions and receive and timeout operations.
Functions versus Altsteps• Two similar concepts, where are the differences?
Guideline: Use functions, whenever possible
Functions Alts teps-------------- ---------Return value No re turn valuecan't be used as default Can be used as default
![Page 97: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/97.jpg)
queryserverPortmtc
Building blocks of a TTCN -3 Test Suite
Test Behaviorresponse
testcase TC_resolveTCLOUDWww() runs on DnsClient{
timer t_ack;serverPort.send(m_dnsQuestion (‘www.tcloudtech.com ’));t_ack.start(1.0);alt {
[]
© 2012 -TCLOUD Information Technologies Pvt Ltd
[] serverPort.receive(mw_dnsAnswer(“ 176.136.72.81")) {
setverdict(pass);}
[] serverPort.receive { // any other messagesetverdict(fail);
}[] t_ack.timeout {
setverdict(inconc);} }
t_ack.stop;}
![Page 98: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/98.jpg)
Events of two ports(pt_myport,pt_control) and a tim er (t_timer)// Function-local timertimer t_timer;// Function-local variablesvar MyPdu myPdu;var integer count := 0;// Start timert_timer.start(10.0);// Alt-statementalt{
Behavior alternative : Alt Statement (Example)
© 2012 -TCLOUD Information Technologies Pvt Ltd
{// Receive maximum of maxCount PDUs that match with template a_myPdu_r[count < c_maxCount] pt_myPort.receive(a_myPdu_r) -> value myPdu{// Forward the received message via port pt_myOtherPortpt_myOtherPort.send(myPdu);setverdict(pass);count := count + 1;// Wait for next PDUrepeat;}
![Page 99: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/99.jpg)
/* Else if we receive something else than a_myPdu_r (plain .receive matches* with everything)*/[/* Empty boolean guard is treated as true */] pt_myPort.receive{log("Received something else");setverdict(falil);// Execution continues at line “self.stop”}// Else if we receive from control port an instruction to stop[] pt_control.receive(charstring: "stop")
Behavior alternative : Alt Statement (Example contd .)
© 2012 -TCLOUD Information Technologies Pvt Ltd
[] pt_control.receive(charstring: "stop"){log("Received control message ""stop"" via pt_contrl");// Execution continues at line “self.stop”}// Else if timer expires[] t_timer.timeout{// Execution continues at line “self.stop”}}self.stop;
![Page 100: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/100.jpg)
Behavior alternative : Altstep (Example)
altstep alt_timeGuard ( inout timer p_t ) {[] p_t.timeout { setverdict ( fail ) }};
t_guard.start ( 30.0 );
�could be used within an alt statement in the following manner
altstep definition:
© 2012 -TCLOUD Information Technologies Pvt Ltd
t_guard.start ( 30.0 );alt {[] pt_ticket.receive ( a_ticketA ) {t_guard.stop ;setverdict ( pass )};[] alt_timeGuard( t_guard );}
An altstep can also be activated as one of the default alternatives.
![Page 101: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/101.jpg)
testcase Testcase1() runs on DNSTester {
P.send (query);
P.receive (answer);
setverdict(pass );
stop ;}
Client DNS
Alt statement: Revisit DNS Tester Example)
Behavior alternative
© 2012 -TCLOUD Information Technologies Pvt Ltd
Client
(“www.tcloudtech.com”, A)
(“www.tcloudtech.com”, 176.136.72.81 ,A)
DNS
Pass
![Page 102: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/102.jpg)
Behavior alternative : Erroneous Behavior (DNS Teste r Example)
Client DNS
• P.receive(answer) blocks until it receives a message that
matches answer .
• Any other message does not unblock the tester, which then blocks forever.
• If no message is received, the tester will also block forever.
© 2012 -TCLOUD Information Technologies Pvt Ltd
(www.tcloudtech.com, A)
Blocked
![Page 103: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/103.jpg)
Alt statement: Dealing with erroneous behaviour (DN S Tester)testcase Testcase2() runs on DNSTester {
timer t := 5.0;
P.send (query);
t.start ;
alt {
[ ] P.receive (answer) {
setverdict (pass );
}
Client
(www.tcloudtech.com,A)
DNS
© 2012 -TCLOUD Information Technologies Pvt Ltd
}
[ ] P.receive { // any message
setverdict (fail );
}
[ ] t. timeout {
setverdict (inconc )
}
}
stop ; }
inconc
![Page 104: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/104.jpg)
Non-local DNS Query
Send fully qualified hostname
Return IP-addressLocal N/W
client
Internet’s root service
Parallel Test Component 1
Parallel Test Component 2
Tester
© 2012 -TCLOUD Information Technologies Pvt Ltd
root service
Remote DNS
Parallel Test Component 2
Main Test Component
Local DNS
System Under Test
![Page 105: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/105.jpg)
Non-local DNS Query contd.
Client
(“www.tcloudtech.com”,A)
DNS Root NS NS
(“tcloudtech.com”,NS)
(“tcloudtech.com”,”tcloudtech.com,NS)
(“www.tcloudtech.com”,A)
© 2012 -TCLOUD Information Technologies Pvt Ltd
Pass
(“www.tcloudtech.com”,A)
(“www.tcloudtech.com”, 176.136.72.81 ,A)
(“www.tcloudtech.com”, 176.136.72.81 ,A)
![Page 106: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/106.jpg)
� Introduction to Test Data type, Actual test data, T est Configuration- Test component, Communication ports, Functions, Test Behavior - Control and monitor component - How TTCN-3 supports concurrent architectures- Behavior alternative
� Foreign data (ASN.1) usage in TTCN -3
Building blocks of TTCN -3 test suite
© 2012 -TCLOUD Information Technologies Pvt Ltd
� Foreign data (ASN.1) usage in TTCN -3- Goal, Overview, ASN.1 to TTCN-3 mapping, Conventions,ASN.1/ TTCN-3
type equivalence, Open Type, Other String Types, Structured Types, ASN.1 values, Modules
![Page 107: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/107.jpg)
Foreign data (ASN.1) usage in TTCN -3
Integration of ASN.1 into TTCN -3
� Two approaches• Direct: import ASN.1 modules• Indirect: Convert ASN.1 to TTCN-3, import TTCN-3• Same definitions are available
• m1.asn1:
© 2012 -TCLOUD Information Technologies Pvt Ltd
• m1.asn1:module m1 ....
• t.ttcn3:module t {
import from m1 language "ASN.1:1997" all;}
![Page 108: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/108.jpg)
Overview
• ASN.1 to TTCN-3 mapping
• Simple types and constants
• Single Module
Foreign data (ASN.1) usage in TTCN -3
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Single Module
• Single Interface
![Page 109: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/109.jpg)
Foreign data (ASN.1) usage in TTCN -3
ASN.1 to TTCN -3 Mapping
� Given an ASN.1 module, how can the definitions be used in
�TTCN-3 test cases?
�ASN.1: Abstract Syntax Notation One (ITU -T X.680)
© 2012 -TCLOUD Information Technologies Pvt Ltd
�ASN.1: Abstract Syntax Notation One (ITU -T X.680)
�Types, constants� Modules� No behavioral interface
�Mapping to TTCN-3
�Straight forward one-to-one mapping
![Page 110: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/110.jpg)
Foreign data (ASN.1) usage in TTCN -3
�Referencing to ASN.1 modules by standardized langua ge tags
�"ASN.1:1997" for ASN.1 version 1997,� "ASN.1:1994" for ASN.1 version 1994,� "ASN.1:1988" for Blue Book version of ASN.1
Conventions
© 2012 -TCLOUD Information Technologies Pvt Ltd
�Different preprocessing steps
�Replace all “-” with “_”
�TTCN-3 keywords
�Strictly: ASN.1 definitions using TTCN-3 keywords cannot be converted�Solution: append ‘_’ to used keywords
![Page 111: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/111.jpg)
Foreign data (ASN.1) usage in TTCN -3
ASN.1 / TTCN-3 Type Equivalence
© 2012 -TCLOUD Information Technologies Pvt Ltd
![Page 112: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/112.jpg)
Foreign data (ASN.1) usage in TTCN -3
OPEN TYPE / NULL
�ASN.1: OPEN TYPE
� TTCN-3: anytype� Union over types known in a module� ‘known’: defined, imported
© 2012 -TCLOUD Information Technologies Pvt Ltd
�ASN.1: NULL
�TTCN-3: enumerated
�• type enumerated <identifier> { NULL }�• <identifier>: ASN.1 Type reference
![Page 113: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/113.jpg)
Foreign data (ASN.1) usage in TTCN -3Other String Types
• BMPString -> universal charstring( char ( 0,0,0,0 ) .. char ( 0,0,255,255) )
• UTF8String -> universal charstring
• NumericString -> constrained charstring
© 2012 -TCLOUD Information Technologies Pvt Ltd
• NumericString -> constrained charstring
• PrintableString -> constrained charstring
• TeletexString, T61String -> constrained universal charstring
• VideotexString -> constrained universal charstring
• GraphicString -> universal charstring
• GeneralString -> universal charstring
![Page 114: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/114.jpg)
Foreign data (ASN.1) usage in TTCN -3
Structured Types
� SEQUENCE -> record
� SEQUENCE OF -> record of• Including length restrictions
� SET -> set
© 2012 -TCLOUD Information Technologies Pvt Ltd
� SET -> set
� SET OF -> set of• Including length restrictions
� CHOICE -> union
� ENUMERATED -> enumerated
![Page 115: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/115.jpg)
Foreign data (ASN.1) usage in TTCN -3
• One-to-one transformationmyValue MyMessageType ::= {
field1 "A string",field2 123,
field3 {field31 '11011'B,field32 456789,
ASN.1 Values
© 2012 -TCLOUD Information Technologies Pvt Ltd
field32 456789,field33 'FF'O},
field4 {true, false}}
• Missing optional fields are equivalent to omitted f ields in TTCN-3
![Page 116: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/116.jpg)
Building blocks of TTCN -3 test suite
� Introduction to Test Data type, Actual test data, T est Configuration- Test component, Communication ports, Functions, Test Behavior - Control and monitor component - How TTCN-3 supports concurrent architectures- Behavior alternative
� Foreign data (ASN.1) usage in TTCN -3
© 2012 -TCLOUD Information Technologies Pvt Ltd
� Foreign data (ASN.1) usage in TTCN -3- Goal, Overview, ASN.1 to TTCN-3 mapping, Conventions,ASN.1/ TTCN-3
type equivalence, Open Type, Other String Types, Structured Types, ASN.1 values, Modules
![Page 117: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/117.jpg)
� Tool Providers• Testing Technologies• Elvior• Telelogic
TTCN-3 tool providers
© 2012 -TCLOUD Information Technologies Pvt Ltd
• Telelogic• Danet• DaVinci Communications• Strategic Test Solutions• Open TTCN
![Page 118: Ttcn3 Basics](https://reader033.vdocuments.net/reader033/viewer/2022051411/5459ebccb1af9f39378b5a5b/html5/thumbnails/118.jpg)
The TTCN-3 Standards�ES 201 873-1 (Z.140)
TTCN-3 Core Language
�ES 201 873-2 (Z.141)TTCN-3 Tabular Presentation Format (TFT)
� ES 201 873-3 (Z.142)TTCN-3 Graphical Presentation Format (GFT)
�ES 201 873-4 (Z.143)
© 2012 -TCLOUD Information Technologies Pvt Ltd
�ES 201 873-4 (Z.143)TTCN-3 Operational Semantics
�ES 201 873-5TTCN-3 Runtime Interface (TRI)
� ES 201 873-6TTCN-3 Control Interfaces (TCI)
�ES 201 873-7 and onwards (under development)Using ASN.1, XML, IDL, C/C++ with TTCN-3