DEV Community

Discussion on: Retry brittle tests until they fail

Collapse
 
itsasine profile image
ItsASine (Kayla)

Heh, on my team we call that "run it til it passes." Which also has the mantra of losing all hope first. If it fails, you still had an inkling of hope that it would pass. Only when you lose all hope and the tests win will they grant you a passing run.

I'm just slowly rewriting the tests to suck less now haha There's a similar package available for Protractor but overall it's probably better to have trust in the tests rather than rerun them.

Collapse
 
tombruijn profile image
Tom de Bruijn • Edited

I too lose hope when I have to retry the tests on the CI just to get a green build. Especially if the build takes a long time to complete 😩

I don't like using a package that immediately retries the test on the CI when it does fail. It hides the actual failure and the test suite ends up taking more time to complete. Although, we do use this approach for now on a project where I work 😬 (Just until the test suite isn't so brittle! Promise!)

That's why I suggest this approach of debugging the brittle test locally and fix it. It requires quite a bit of rewrites of tests and app code for it to suck less yes 😅 But I think it's worth it!