As you probably know, KIF tests can be flaky. I'm experimenting with trying to re-run a KIF test if it fails. Not sure if this is the best route but I am overriding the KIF failWithExceptions method to loop three times and on the 4th call the super of failWithException and stop the test. I just can't figure out how to actually launch the test again.
This is what I have now. Next step is to it the testCase and testName, and then invoke that test. Any thoughts?
Thanks
- (void)failWithException:(NSException *)exception stopTest:(BOOL)stop
{
NSLog(@"Test Failed, running again");
int testCount = 0;
for(int i = 1;i <= 3; i++)
{
[self afterEach]; //call the afterEach method to get test in known state
//this is where I want to re-run the test, maybe [XCtest ....] or
testCount += 1;
}
if(testCount==3)
{
[super failWithException:exception stopTest:stop];
}
}