I am trying to run a test case x number of times but cannot find a way to do this without creating a keyword (Which is the test) and then running this in a for loop for x number of iterations.
I also use a batch file but this generates multiple log files and I would like to be able to see all the runs in one file where I can easily check the pass/fail
Any help is appreciated!
hey!
As you said, I would also run it in a loop.
Eg: FOR ${retry} IN RANGE 20
Yeah is kinda ugly though, I agree.
There are various alternatives:
- Test templates
- Running same test multiple times and then combining results with the Rebot tool.
- Using the external data-driver tool.
First two options are explained in the User Guide and you ought to be able to find data-driver project easily as well. I’m a bit hurry and don’t have time to find direct links to more information.
We have found repeating testcases very handy for chasing down seemingly random errors. but we didn’t want to make changes to the test code that @pekkaklarck’s #1 or #3 required.
At the time we wrote a script that just copied the testcase into a folder the required number of times (adding an index to the name) and then executed the folder (in parallel with Pabot) Everything showed up in the same test report.
Option #2 sounds pretty good, but I can’t remember why we didn’t do it that way…
One more approach, similar to copying files, would be using a pre-run modifier to generate tests dynamically.
Hello thank you for the speedy response! I will look into the rebot tool and try to run it at the end of each test automatically
I found a way to run a single test twice, but it does not solve the problem is I want to run the test more than twice, which is what I desire.
From terminal command line type the following command and at the end add three periods:
robot -t “Test Case” Tests …
Hi Adam,
Not sure, you probably found your solution already?
If you want a more reactive approach, it’s also possible to do this with a listener, I built a listener to rerun the same test 5 times, but you’d probably want to change it’s logic to run if result was fail which should be easy enough to do.
The details of my listener (and full working example) are in this thread (below), thanks to @pekkaklarck who helped me a lot to figure that out
Dave.