rootstrap/blog

Solving random tests with RSpec

Ricoch opened this issue · 0 comments

How to fix random failing tests in RSpec

Motivation:

When working on ownable, we found ourselves having a lot of different tests that failed at random. Whenever the full tests suite would be run, it would have some tests randomly failing, but when running those tests directly they will always succeed, making them nearly impossible to fix.
Then, at GiveTide I found myself in a similar situation where some tests were randomly failing, making me having to retry the CI process x amount of times until it succeeded. I then searched and found bisect functionality in RSpec. I believe this also happens in a lot of other projects so this could help some people going through the same randomly failing tests issues.


📌 Notes:

Examples of random tests
Walkthrough of an example


🔍 Keywords:

rspec, random tests, random fails, bisect, rails