Getting total number of testcases to be executed in suite

151 views
Skip to first unread message

msiko...@gmail.com

unread,
Jan 14, 2014, 2:53:40 AM1/14/14
to robotframe...@googlegroups.com
Hello,
I've been using RF for several months and found it very useful - thanks for great tool.
Now I've decided to join this group share my experience and get some help.

I have a big set of test cases in suite and execution takes quite a long time. 
I'd like to print a console message with current suite progress at the end of every test (so far there is only 1 suite).
Counting current test number is not a problem but is there a way to get a total number of test cases to be executed?
Pybot is run by shell script and I'm allowing user to pass test name pattern to '--tests' so total number of tests will vary for
each run. 
I wonder if there is any special variable or another way to get this total number o test cases to be executed at the beginning of suite execution.
I was searching group but didn't find topic which will exactly answer my problem.

Thanks for any hints,
Mariusz

Pekka Klärck

unread,
Jan 15, 2014, 4:07:02 AM1/15/14
to msiko...@gmail.com, robotframework-users
2014/1/14 <msiko...@gmail.com>:
> Hello,
> I've been using RF for several months and found it very useful - thanks for
> great tool.
> Now I've decided to join this group share my experience and get some help.

Thanks for compliments and welcome aboard!

> I have a big set of test cases in suite and execution takes quite a long
> time.
> I'd like to print a console message with current suite progress at the end
> of every test (so far there is only 1 suite).

Yeah, this would be a handy generic feature. There's even an old issue about it:
http://code.google.com/p/robotframework/issues/detail?id=318

The main problem implementing the above issue is that updating the
console so that all relevant information is easily visible is hard in
generic manner. Python's `curses` module ought to support it, but it
doesn't work on Windows and I doubt it works with Jython either. If
anyone has ideas how to implement this, please let us know!

> Counting current test number is not a problem but is there a way to get a
> total number of test cases to be executed?
> Pybot is run by shell script and I'm allowing user to pass test name pattern
> to '--tests' so total number of tests will vary for
> each run.
> I wonder if there is any special variable or another way to get this total
> number o test cases to be executed at the beginning of suite execution.
> I was searching group but didn't find topic which will exactly answer my
> problem.

The easiest way to implement this yourself is using the listener interface:
http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html#using-listener-interface

Every start_suite method gets the amount of tests in that suite,
recursively, and by listening to start_test you can count which tests
is running.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org
Reply all
Reply to author
Forward
0 new messages