stats by keyword

82 views
Skip to first unread message

Laurent Bristiel

unread,
Jun 5, 2013, 3:07:08 AM6/5/13
to robotframe...@googlegroups.com
Hello,

I am working on enhancing the performance of my robot tests on a regular basis.
What I often miss is the stats by keyword.
Something like a list of keyword with how much time was spent on it.
Example:
  - total running time : 55 minutes
     - keyword "run my sut" : 29 minutes
     - keyword "configure audit" : 12 minutes
     - keyword "clean log after run" : 11 minutes
    etc.
That would be quite handy to know on which keyword I should focus my effort.
Information is probably in the raw XML file but I wonder if someone already took the effort to sort it out this way.

Thanks,
Laurent

Pekka Klärck

unread,
Jun 5, 2013, 3:23:12 AM6/5/13
to lau...@bristiel.com, robotframe...@googlegroups.com
2013/6/5 Laurent Bristiel <lau...@bristiel.com>:
Yes, all this information is available on the XML file and Robot's own
result parsing modules make it easy to get [1]. There's also ready
made times2csv.py tool [2] for getting execution times from the XML
into a CSV file that can be further investigated e.g in Excel.

[1] https://robot-framework.readthedocs.org/en/2.7.7/autodoc/robot.result.html
[2] 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

Laurent Bristiel

unread,
Jun 18, 2013, 6:32:56 AM6/18/13
to robotframe...@googlegroups.com, lau...@bristiel.com
Thanks Pekka.
I tried to use the Robot's parsing module.
I could do more or less what I wanted to do:
https://github.com/laurentbristiel/elapsed_by_keyword

Only thing I did not find out was how to "visit" the keywords recursively.
My code just visit the first level keywords, whereas I would have like to be able to visit all the levels (or choose a depth).
I will try to keep on working on that.

Laurent

Pekka Klärck

unread,
Jun 18, 2013, 4:44:42 PM6/18/13
to lau...@bristiel.com, robotframe...@googlegroups.com
2013/6/18 Laurent Bristiel <lau...@bristiel.com>:
> Thanks Pekka.
> I tried to use the Robot's parsing module.
> I could do more or less what I wanted to do:
> https://github.com/laurentbristiel/elapsed_by_keyword

Looks nice!

> Only thing I did not find out was how to "visit" the keywords recursively.
> My code just visit the first level keywords, whereas I would have like to be
> able to visit all the levels (or choose a depth).

This happens because your visitor overwrites visit_keyword method that
takes care of the recursion. The easiest solution is to override
start_keyword (or end_keyword) instead, and let visit_keyword's
default implementation handle recursion for you. Notice that if you,
for any reason, want to stop the recursion, your start_keyword just
need to return explicit False.

It's a shame the visitor interface is not documented better. It is
really powerful and easy to use when you know what you are doing.
Could you submit an issue about enhancing docs related to it? I'm sure
we find time to take care of that at some point. Until that, it's
probably easiest to look at the source to see how base visitors are
implemented and how they are used internally in the framework.
Reply all
Reply to author
Forward
0 new messages