Is there a simple way to implement failure tolerance in ScalaTest? I'm looking to run the same test 50 times and give it a tolerable error margin, e.g. 10%.
In the above case, the test would only pass if 45 out of 50 tests were successful.
The best way to do that is to override withFixture
and rerun failed tests using whatever algorithm makes sense in your particular case. For inspiration, I'd suggest you look at the Retries
trait in ScalaTest itself. The Scaladoc is here:
http://doc.scalatest.org/2.1.0/index.html#org.scalatest.Retries
The actual source code for Retries
is here:
https://github.com/scalatest/scalatest/blob/master/src/main/scala/org/scalatest/Retries.scala