Skip to main content

Fix Your Flaky Tests

Selenium tests are my least favorite tests to write, run and maintain. We use Jest to test UI components and logic whenever possible, but Selenium tests are still irreplaceable for many test cases.

Occasionally we'd get a flaky selenium test that fails relatively reliably on our Jenkins machines but is hard to be reproduced locally on my 2013 Macbook which is significantly slower.

The majority of, if not all of the time, it'd be a test issue where there's a stupid timing error somewhere and I'd have to run the test many times locally until it fails to figure out where exactly the problem is. And after fixing it, I'd also run it many times just for peace of mind.

How nice would it be if I could easily run the same test multiple times in a row and report back the results? That is totally doable and extremely easy too!

How to run JUnit tests multiple times in Eclipse with JUnit Suite

Run a test multiple times with the Parameterized annotation




Comments