Chapter 15
Advice and Examples
Throughout this book, we have given numerous examples to introduce the concepts of TTCN-3. But we did not say anything specific on how to write TTCN-3 in a reasonable way. However, in large projects it is important to have the TTCN-3 code well written. Therefore, in this chapter we will discuss the importance of using a TTCN-3 style guide. We will also give some further examples. These examples range from small but nevertheless useful functions to complete examples for recurring problems.
15.1 TTCN-3 Style Guide
Because TTCN-3 can in principle be considered as a programming language, all the usual issues of how to write programs have to be considered. In this section, we will show which issues should be considered in a style guide for TTCN-3 and we will explain some of the rules we followed when writing the examples in this book.
15.1.1 Motivation
To know what actually has been tested by a test case, one has to be able to understand it. Typically, the system under test (SUT) evolves over time and the corresponding test suite also has to evolve. Therefore, maintainability of the test suite is quite important. A third important issue is raised by the fact that such test suites are quite often developed by subcontractors. This is then done in collaboration with the developer of the SUT. Therefore, the test suite must be written such that it can be split into parts that each company can then reasonably work on. Such a separation into parts can be achieved ...