What I’m trying to do is basically the opposite of Retries, since we want to eradicate flickers ASAP.
When mixed into a Suite, each test must pass N number of times before it is reported as passing.
I’m not overriding `runTest`, since I don’t want to report the running test multiple times, so I’m using
withFixture. However, “before” is only run once.
override protected def withFixture(test: NoArgTest): Outcome = {
val Times = 8
@tailrec def rerunUntilPass(iteration: Int): Outcome = {
if (iteration == Times) {
// On the last invocation we just return the outcome
super.withFixture(test)
} else {
super.withFixture(test) match {
case Succeeded ⇒ rerunUntilPass(iteration + 1)
case other ⇒
alert(s"Test `${ test.name }' failed at iteration ${ iteration } of ${ Times } needed")
other
}
}
}
rerunUntilPass(1)
}
How can I run before / after, or not emit reporter events when overriding `runTest`