As many Elixir devs, I'm also a fan of the fact that elixir comes with testing support included via mix test. What's great is that there are many features to make our lives easier when we have to run or maintain our tests.

Here I'm listing 5 features/flags/arguments that I particularly loved!

--failed

Running only the tests that have failed in the last run is useful to keep us focused on getting the tests back to green.

--slowest

Is your test suite getting slower? Quickly find out where the bottlenecks are.

--listen-on-stdin

Useful for running the tests whenever a file is changed! Beautiful to keep the feedback cycle short 😍

--stale

Run only the tests that reference files that have changed since the last time the tests were run with --stale. Again, another beautiful way to quickly run the tests and keep you focused.

Run by line number

The last one is not a flag, but just a quick way to run a specific test. Simply append :N to the file name in the mix command and only the test that touches that line number will run. Eg.:

$ mix test test/a_test.exs:8

Bonus: when a test breaks, the file name with the line number is displayed on the second line. Eg.:

1) test hello world (HelloWorldTest)
     test/hello_world_test.exs:7
     Assertion with == failed
...

It's just a matter of copying that line and appending it to mix test.