Is it allowed to retry failed tests until they pass?

If your tests fail randomly, don’t just keep rerunning them until they pass, as it might mask issues like race conditions or deadlocks. Instead, concentrate on retrying only the unstable parts of your test that aren’t directly related to its main goal. For instance, if there’s a failure in connecting to an external webservice during the test, retry that specific connection within the test rather than rerunning the entire test. This method prevents hiding rare failures and makes it easier to analyze and understand them through logging.

Leave a Comment

GDPR Cookie Consent with Real Cookie Banner