This is probably old news, but I only recently found out that there is a way for Cucumber tests running in Ruby to automatically retry when they fail.
Here’s a sample failing test:
Apparently we can just add a
--retry command to set the test to retry if it fails. And we can set how many times we want the test to retry. If we retry the failing test above to retry two times, with a
--retry 2 command, we’ll get the following output:
It did retry the test twice, after the initial failure. Neat! 🙂
But what happens if we run the test, with the same retry command, and the test passes? Does the test run three times? Let’s see:
Good, the retry command gets ignored when the test passes.