STOPWATCH

From iMacros
Jump to: navigation, search

Measures the time in seconds between two STOPWATCH commands with the same identifier.

This command can be used for website response time measurement. Using different IDs in one macro different processes can be timed separately from each other. By default the measured data is stored in the download directory of iMacros. You can change the file location with the !FILESTOPWATCH variable. (PRO and SCRIPTING Editions only).

Syntax iMacros Browser IE Plug-in Firefox Chrome

STOPWATCH ID=id

Note that you need a matching pair, as this command returns the difference between two STOPWATCH commands.

Since V6.85+ you can also get the absolute time since macro start with

STOPWATCH LABEL=id

Since STOPWATCH LABEL returns the time since macro start, only one command per measurement is required.

Note: iMacros for Firefox V6.6.5 and later already contains the new iMacros V7 style stopwatch format. Please see this discussion for details and to give feedback.

Parameters

  • ID
    Specifies an unique identifier for a timing measurement. Up to 100 different identifiers can be used.

Examples

The following screenshots are taken from our web testing workshop slides:

Performance report.png

Performance report over time.png

Example macro:

VERSION BUILD=8031994
TAB T=1
TAB CLOSEALLOTHERS 
'
'We can change the folder where the performance log file is going to be saved 
'by setting !FOLDER_STOPWATCH. Otherwise it is saved in iMacros\Downloads folder
'SET !FOLDER_STOPWATCH c:\Temp  
'Note: Use SET !FOLDER_STOPWATCH NO if you do NOT need a response time log file 
'(for example, if you retrieve the values with the Scripting Interface via iimGetStopwatch)
'SET !FOLDER_STOPWATCH NO
'SET !FILESTOPWATCH C:\Temp\demo-stopwatch.csv  

'
'Start reponse time measurement  
'Measure total macro runtime
STOPWATCH ID=Total
'Measure load time for first page
STOPWATCH ID=Firstpage
URL GOTO=http://demo.imacros.net/Automate/StopWatchDemo
STOPWATCH ID=Firstpage 

TAG POS=1 TYPE=A ATTR=HREF:http://demo.imacros.net/Automate/AutoDataEntry   
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/Automate/FormSubmit ATTR=NAME:fname CONTENT=Tom
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/Automate/FormSubmit ATTR=NAME:lname CONTENT=Testerr 
'Measure server reaction on submit
STOPWATCH ID=SubmitData
TAG POS=1 TYPE=BUTTON:SUBMIT FORM=ID:demo ATTR=TXT:Submit
STOPWATCH ID=SubmitData 

STOPWATCH ID=Store1
'Measure time for secure Online store to open
'go to store
URL GOTO=http://imacros.net/overview
TAG POS=1 TYPE=A ATTR=TXT:*Buy*
'open store =>  start timer
TAG POS=1 TYPE=A:BUTTON ATTR=TXT:Buy<SP>Now  
STOPWATCH ID=Store1

'Measure time for second page  
STOPWATCH ID=Total

WAIT SECONDS=2
URL GOTO=http://demo.imacros.net/Automate/StopWatchReport
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:form1 ATTR=ID:path CONTENT="In iMacros Downloads folder"

The file "performance_Stopwatch.csv" contains the measurement data. By default the data is saved to the Downloads\ directory of your iMacros installation. The values are comma separated (CSV format) so they can be viewed with any text editor or imported directly in Excel or any other software you use to view your data.

Example file Format: Date, Time, ID, time (s)

"Date: 2013/02/11,  Time: 11:00, Macro: Stopwatch.iim, Status: OK (1)"
2013/02/11,11:00:30,Firstpage,1.698
2013/02/11,11:00:33,SubmitData,0.555
2013/02/11,11:00:34,Store1,8.045
2013/02/11,11:00:30,Total,11.256

See Also

!FILESTOPWATCH, !STOPWATCHTIME, REFRESH, CLEAR, Demo-Stopwatch, Get-Response-Times.vbs, iimGetStopwatch