Chapter 3
Basic TTCN-3
In the first two chapters of this book, we have provided you with a high-level introduction of the most important aspects of TTCN-3 as a testing language. In this chapter, we will make the first transition to code level, gradually introducing language concepts that will lead to our first complete code example. It is expected that the reader has at least some prior programming experience with modern programming languages to fully benefit from the information in this chapter.
A TTCN-3 test suite is made up from one or more modules. A module is identified by a unique name and may contain a definitions part and optionally also a control part. The control part can be seen as similar to the main function in other programming languages and should only be present at one given place. The following sections will concentrate on the constructions found in the definitions part, which include among others, variables, constants, expressions and operators, as well as type and function definitions.
3.1 Basic Constructs
In this section, we will take a more detailed look at some of the language constructs that can be found in the module definitions part. We introduce identifiers and the rules that apply for their naming. We also explain the scoping and visibility rules of the language and we start off by having a look at constants and variables, leading on to data types, templates and eventually functions. The example code will be related to the DNS server domain, which has ...