Using timers with functional test scripts

You can insert any number of timers with different names into the same script to measure the time it takes to perform a variety of separate tasks. You can nest timers within other timers (starting and stopping the second timer before stopping the first timer), and you can overlap timers (stopping the second timer after stopping the first timer).

About this task

However, you should stop a timer before starting that same timer again. If you start the same timer again, Rational® Functional Tester changes the starting time. When you stop a timer, Rational® Functional Tester writes a message to the log that indicates the time elapsed from when the timer started. If you stop the same timer multiple times, Rational® Functional Tester does not restart the timer. You should call timerStart if you want to restart the timer.

When you play back a script that includes timers, you can view the elapsed time in the log.

To insert a timer while recording or editing a script:

Procedure

  1. If recording, click the Insert Script Support Commands button Insert Script Support Commands button on the Recording toolbar.

    If editing:

    1. Position the pointer in the script where you want to place the timer.
    2. Click the Insert Recording into Active Functional Test Script button Insert Recording into Active Functional Test Script button on the product toolbar.
    3. Click the Insert Script Support Commands button Insert Script Support Commands button on the Recording toolbar.
  2. Click the Timer tab in the Script Support Functions dialog box.
  3. In the Start Timer: Name field, type a timer name. If you start more than one timer, make sure you give each timer a different name.
  4. Click Insert Code.

    Rational® Functional Tester inserts the timerStart("name")code at the cursor location in the script where name is the name you entered in Start Timer: Name field.

  5. Perform the activity you want to time.
  6. Immediately after the timed activity, stop the timer:
    1. Click the Insert Script Support Commands button Insert Script Support Commands button on the Recording toolbar.
    2. Click the Timer tab in the Script Support Functions dialog box.
    3. In the Stop Timer: Timers field, select from the list the timer that you want to stop.

      If you do not see the timer name in the list, type the name in the combo box.

    4. Click Insert Code.

      Rational® Functional Tester inserts the timerStop("name") code at the cursor location in the script where name is the name you selected in Stop Timer: Timers field.

      Note: Do not insert a timerStop statement before the corresponding timerStart statement.