Chose your tests wisely on elixir

Once a great man said.

The game has its ups and downs, but you can never lose focus of your individual goals and you can't let yourself be beat because of lack of effort.

Michael Jordan

Michael Jordan is nothing more than one of the best players that ever lived. Based on that focus is also really important for our software. When we build software most of the times we most focus on do one thing right and guaranty that it doesn't fall apart.

That's a trick that can be used with ExUnit to focus on a specific test so we can develop a feature and modify a code without running all the tests (which can take some time depending on the size of your app).

For that ExUnit comes out of the box with the ability to add tags to your code so it's possible choose what code can be executed. In this case I like to always add the tag :focus on the test that I mos interested on at the moment.

#...

@tag :focus
test "I say good bye and you say hello" do  
  assert Module.say("good bye") == "hello hello hello"
end  

This way all I do is run:

mix test --only focus  

And it's done.. it shows that I have a bunch of tests skipped but only one that passes at the time.

.

Finished in 0.1 seconds (0.1s on load, 0.00s on tests)  
82 tests, 0 failures, 81 skipped