Rerun failed testcases

737 views
Skip to first unread message

Sajjad Malang

unread,
Jan 11, 2011, 5:48:17 AM1/11/11
to robotframe...@googlegroups.com
Hello,
What is the best way to re-run only the testcases the have failed from the previous run. I would like to know how others are doing this. here is the scenario.

I am developing 100 testcases. I have written all of them.
I run them and it runs to 30 min. and see the 40 have failed due to typos or other silly mistakes.
I correct them and want to just run the 40 failed ones. But I dont like to add 40 --include's in the command line just for this run or wait another 30 min to run all of them.

What is the best approach for this. How do others manage this? 

Thanks in advance.

--
Regards,
\Sajjad.


Juha Rantanen

unread,
Jan 11, 2011, 6:04:27 AM1/11/11
to sajjad...@gmail.com, robotframe...@googlegroups.com
Hi,

Currently there is no easy way to do this, but there are plans to
include this functionality [1] into the next Robot Framework release.
Before that it would be possible to use Robot's internal APIs [2] to
read the test cases and write the --test options to i.e. arguments
file.

[1] http://code.google.com/p/robotframework/issues/detail?id=702
[2] http://robotframework.googlecode.com/svn/tags/robotframework-2.5.5/doc/userguide/RobotFrameworkUserGuide.html#executed-test-data

Br,
Juha

--
Juha Rantanen
agile tester/coach @ reaktor.fi

2011/1/11 Sajjad Malang <sajjad...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups
> "robotframework-users" group.
> To post to this group, send email to robotframe...@googlegroups.com.
> To unsubscribe from this group, send email to
> robotframework-u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/robotframework-users?hl=en.
>

tmpalaniselvam

unread,
Jan 11, 2011, 9:15:38 AM1/11/11
to robotframework-users
Sajjad,

We have developed a mini app in C# to run the failed cases. But it
will not store all HTML results.

NOte: I can share it, if you interested..

Thanks,
Palani.
http://tips-testing.blogspot.com/index.html

Mikko Korpela

unread,
Jan 11, 2011, 1:22:50 PM1/11/11
to sajjad...@gmail.com, robotframe...@googlegroups.com
Hello!

This (partly http://code.google.com/p/robotframework/issues/detail?id=757&colspec=ID%20Type%20Status%20Priority%20Target%20Owner%20Summary%20Stars&start=100)
works:

gather_failed_tests.py:
#!/usr/bin/env python

"""Usage: gather_failed_tests.py inpath [outpath]

Reads result of a test run from Robot output file and gathers failed
test names to
an argument file (default failed_tests.txt). Note! This works only
when all tests
have differing names.

To re-run failed tests:
pybot --argumentfile failed_tests.txt ..
"""
from __future__ import with_statement
import sys
from robot.output import TestSuite

def check_tests(inpath, outpath=None):
if not outpath:
outpath = 'failed_tests.txt'
suite = TestSuite(inpath)
with open(outpath, 'w') as outfile:
gather(suite, outfile)

def gather(suite, outfile):
if suite.status == 'PASS':
return
for test in suite.tests:
if test.status == 'FAIL':
outfile.write('--test %s\n' % (test.name))
for subsuite in suite.suites:
gather(subsuite, outfile)

if __name__ == '__main__':
try:
check_tests(*sys.argv[1:])
except TypeError, e:
print e
print __doc__

2011/1/11 Sajjad Malang <sajjad...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups
> "robotframework-users" group.
> To post to this group, send email to robotframe...@googlegroups.com.
> To unsubscribe from this group, send email to
> robotframework-u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/robotframework-users?hl=en.
>

--
Mikko Korpela

Pekka Klärck

unread,
Feb 2, 2011, 4:38:25 PM2/2/11
to mikko....@gmail.com, sajjad...@gmail.com, robotframe...@googlegroups.com
Hello,

I just attached an enhanced version of Mikko's script to issue 702 [1]
that requests adding rerun capability to the core framework. The
enhancement is that when using the yet to be released RF 2.5.6 or
never, the script will use long names of tests (2.5.6 supports using
them with --test option [2]). With earlier version it will use just
tests' own name which will result with possible other tests with same
name to be executed.

I hope this script is useful until we get the rerun functionality into
the core framework.

[1] http://code.google.com/p/robotframework/issues/detail?id=702
[2] http://code.google.com/p/robotframework/issues/detail?id=757

Cheers,
.peke

2011/1/11 Mikko Korpela <mikko....@gmail.com>:
> Hello!
>
> This (partly http://code.google.com/p/robotframework/issues/detail?id=757)

Reply all
Reply to author
Forward
0 new messages