Rerun tests if they fail to avoid false positives

I was wondering if there is a way to rerun the tests if the tests if they fail? We want to avoid any false positives. In our build environment we have a circle.yml file where we override the test run. Our acceptance tests are built in a rspec, capybara framework. We want to be able to rerun the tests x number of times before it actually reports them as being failed. Does anyone know how to do this in circleci?

@mattrobbins did you manage to come up with a strategy for this? This is something we are also trying to do.

Yes I did. We ended up using the gem rspec-retry and configured it the way we wanted it to work.

Hopefully that will help you.

Unfortunately in our case it’s a suite of JS tests but some similar functionality is definitely what we need. Thanks for letting me know!

I tried this gem a while ago but somehow got confused about how to configure it properly and then let that slide and never looked back.

Could you please share how you are using it so that I might reconsider ?
I’m really bored of having to look at the CircleCI failures and guess if they failed randomly or not.

Thanks !