extract Elapsed time

2,139 views
Skip to first unread message

MichaelSh

unread,
Nov 30, 2010, 6:38:05 AM11/30/10
to robotframework-users
Hi,
The Robot output files (log.html, report.html and output.xml) include
“Start / End / Elapsed” times of each instruction.
I'm trying to figure out how I can extract "Elapsed time" during the
runtime for further usage.

For example:
1. Run command
2. Extract “Elapsed time” (and convert to number )
3. If “Elapsed time” > 0 then stop the test


Does Robot provide something in this performance area?

Thanks in Advance,
Michael

Pekka Klärck

unread,
Dec 2, 2010, 3:46:11 PM12/2/10
to michae...@gmail.com, robotframework-users
2010/11/30 MichaelSh <michae...@gmail.com>:

There's no direct support. You could try using `Get Time` keyword from
BuiltIn in the beginning of a test to store the start time and compare
it with new time later.

Adding an automatic variable that contains the test execution time
would be possible. Or actually variables as there probably should be
separate variables for the current test, current suite, and whole
execution. Would anyone else found these variables useful?

Notice also that there's a separate tool to get the execution times
after the execution:
http://code.google.com/p/robotframework/wiki/ExecutionTimeReportingTool

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

MichaelSh

unread,
Dec 5, 2010, 9:10:19 AM12/5/10
to robotframework-users
Thanks
Michael

On Dec 2, 10:46 pm, Pekka Klärck <p...@iki.fi> wrote:
> 2010/11/30 MichaelSh <michael.sh...@gmail.com>:

Densil D'silva

unread,
Mar 7, 2014, 3:24:57 AM3/7/14
to robotframe...@googlegroups.com, michae...@gmail.com
Wats the ideal way to find the elapsed time using the time delta.
     ${A1}=   Get Time   epoch     
     Sleep     2s
     ${B1}=  Get Time    epoch
     ${a}=   Evaluate    ${B1}-${A1}
     ${elapsed}=   Get Time   hour min sec   ${a}
     Log    ${elapsed}
I am getting the our put as 
['05', '30', '02']
Looks like it use the time zone into effect I see +5.30 is added to this, can we get around this?
Reply all
Reply to author
Forward
0 new messages