Disabling tests with a @tag :skip
I've worked in systems where you can specify different groups of test. For example the last place I worked allowed you to mark a test around the specific domain, whether or not it was an integration test or a unit test as well as whether or not it was a historically slow test. It turns out that ExUnit has tagging support built right into it.
I was curious to see if I could target specific groups of tests. Particularly I wanted to exclude some tests that have been flaky. This is natively suppored in ExUnit.
To do so first find your test that you want to exclude.
defmodule App.ExampleTest do #... test "Some flaky test" do # ... end end
@tag :skip above the test.
defmodule App.ExampleTest do #... @tag :skip test "Some flaky test" do # ... end end
mix test at this point wouldn't cause the test to be excluded. You need to make one more change. Go to
test/test_helper.exs and then update the
ExUnit.start to pass in an exclude argument.
# test/test_helper.exs # Exclude tests with @tag :skip ExUnit.start(exclude: [:skip])