How to re-run failed elixir tests

More often than not when we run our test suites there may be a few tests that fail so we go ahead and modify our code then run the test suite again. As a project grows it’s not unusual to have hundreds of tests so running the full suite again can take a considerable amount of time.

To speed things up we can prevent the full suite of tests being checked by just checking the previously failed tests.

> mix test --failed
> running 2 tests

Once all the failed tests are passing again it’s still important to run the full suite again just incase our new changes broke any other tests that didn’t originally fail.

Matthew Henley

🖥 Software engineer. React, Elm and Elixir enthusiast 🐣