Chapter 4
Single Component TTCN-3
TTCN-3 has been developed for testing. A central notion of TTCN-3 is the concept of test cases. Test cases define which events are sent to the system under test (SUT) and how to react to events received from that system. In this chapter, we consider only message-based communication with the SUT and test cases executed on a single test component, that is non-concurrent TTCN-3. The subject of concurrent test cases running on several test components will be covered in Chapter 5. Chapter 6 will cover the area of procedure-based communication in TTCN-3 test cases.
In this chapter, the concepts for message-based communication and non-concurrent test cases are introduced with an example. We use this example to introduce the structural concepts of ports, components and timers. In addition, we also introduce the concepts of test cases and their verdicts and introduce the alt statement, altsteps and functions.
In this section, we use a ticket vending machine for regional trains as our example. The vending machine accepts 10 cent, 20 cent, 50 cent, 1 Euro and 2 Euro coins. Similarly, it can return coins of these values. These coins are modelled as a corresponding subset of integer, where the 1 and 2 Euro coins are modelled as 100 and 200, respectively. The geographical area served by the regional train system is partitioned into a set of zones. Three different tickets are offered: an ‘A’ ticket that allows travel within a single zone, a ‘B’ ticket that allows ...