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, HCL OneTest™ UI changes the starting time. When you stop a timer, HCL OneTest™ UI writes a message to the log that indicates the time elapsed from when the timer started. If you stop the same timer multiple times, HCL OneTest™ UI 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
- If recording, click the Insert Script Support Commands button on the Recording toolbar.
If editing:
- Position the pointer in the script where you want to place the timer.
- Click the Insert Recording into Active Functional Test Script button on the product toolbar.
- Click the Insert Script Support Commands button on the Recording toolbar.
- Click the Timer tab in the Script Support Functions dialog box.
- 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.
- Click Insert Code.
HCL OneTest™ UI inserts the
timerStart("name")
code at the cursor location in the script where name is the name you entered in Start Timer: Name field. - Perform the activity you want to time.
- Immediately after the timed activity, stop the timer: