Auto Re-Running of Tests that fail
Posted
by Tangopop
on Stack Overflow
See other posts from Stack Overflow
or by Tangopop
Published on 2010-06-04T14:15:09Z
Indexed on
2010/06/05
21:12 UTC
Read the original article
Hit count: 189
I have a set of Selenium/MbUnit Tests that work fine, but tend to take a while to run (over 4 hours) A problem i am finding is that about 1 in 20 test seems to timeout when running. I have confirmed the Selenium GRID is working and the Selenium RC's are all fine, it just seems to be a qwerk of the system. What is really annoying though is that if i run these tests again they will usually pass.
What i want to know is if there is a way for me to auto rerun the tests (probably in the code) if a perticular type of exception is caught...
I have attempted to put a few lines of code in the catch statement but i know this is a very hacky way of re running the tests. Here is the code:
catch (AssertionException e)
{
if (e.Message() == "TimeOut") //Something similar to this
{
this.Test();
}
else
{
verificationErrors.AppendLine(browserList[i] + " :: " + e.Message);
}
}
Any suggestions?
© Stack Overflow or respective owner