You can define timing constraints directly in the test behavior
code or from the test data table (TDT) to measure the duration of a method
call or a sequence of method calls.
To add a timing constraint:
- Open the test behavior source code in the Java™ editor.
(To find the source code, open the Package Explorer view, expand the test
project you are storing the test in, and expand the Behavior folder.)
- Position the cursor at the location in the code where you want
to start the timer.
- Right-click and click .
- Specify a name for the timer.
The starting
point for the timer is added to the test behavior code. For example, if the
timer is named timersetrate, the following code is added:
ComponentTest.startTimer("timersetrate");
- Position the cursor at the location in the code where you want
to end the timer.
- Right-click and click .
The
timer validation is added to the test behavior code, and a new row is added
to the test data table at the point where the timer needs to be verified.
For example, if the timer is named timesetrate, the following
code is added:
ComponentTest.checkTimer("timersetrate");
- In the test data table, insert a timing constraint for the timer.
For example, to verify that the total time of completion for the methods you
are timing is greater than or equal to 2 milliseconds, define the value in
the test data table row as > = 2 ms.