17 UML 2.0 Testing Profile 501
Time Concepts When specifying tests, time concepts are essential to provide
complete and precise specifications. U2TP provides two additional time concepts
to the existing UML 2.0 simple time concepts: Timer and time zone.
Timers are utilized to manipulate and control test behavior, as well as to
ensure the termination of test cases. A timer is owned by an active class. A
timer can be started with a certain time value. The predefined time value of a
timer has always to be positive. An timer may be stopped as long as it is still
active. The expiration time of an active timer can be read and its live status
asked for. When a timer expires after its predefined time, a special timeout
message is generated automatically. It is sent immediately to the class which
owns the timer.
Timezones serve as a grouping mechanisms for test components within a
distributed test system. Each test component belongs at most to one timezone.
Test components of the same timezone have the same time value and thus are
considered to be time-synchronized. The timezone of a test component can be
accessed both in the model and at run-time. Comparing time-critical events
within the same timezone is allowed.
17.3 Test Execution Via Mappings
The U2TP document defines mapping rules for the test languages JUnit [JUn]
and TTCN-3 [Ins03]. The reason for choosing these two languages is quite sim-
ple: Firstly, JUnit is a Java based unit test framework which has become very
popular in the eXtreme Programming domain because of its simplicity and user-
friendliness and TTCN-3 is well-known in the tele-communication test domain.
Secondly, when U2TP is developed, the concepts of JUnit and TTCN-3 served
as roots for the U2TP. Therefore, the mapping rules are quite straight-forward,
though in some cases not complete. Especially the mapping from U2TP to JUnit
is not complete. The reason for that is that U2TP is also defined to specify more
complex tests, e.g. integration tests or system tests, whereas JUnit is only suit-
able for unit tests. Also for TTCN-3, not all concepts can be mapped because
U2TP provides some more advanced test concepts than TTCN-3.
Nevertheless, the provided mapping rules defined in the U2TP document are
not the only way to map between U2TP and JUnit to TTCN-3, respectively.
They only serve as references. In the following, we will firstly introduce JUnit
and TTCN-3 briefly and then explain their mapping rules to U2TP.
17.3.1 JUnit
In order to test that their code works, people watch the code using calls like
System.out.println or debugger. This approach has three problems: scroll blindness,
subjectivity and lack of automation [HL02b]. First, it is hard to tell if a complex
system is working because so many
System.out.println methods are printing so
much garbage. Second, it is hard to follow all the printed lines on the console.
Third, when the develper makes changes in the code, things can break in an