Skip Pending Tests in ExUnit
In ExUnit you have the ability to tag a test with any atom:
@tag :awesome
test "my awesome test" do
end
@tag :terrible
test "my terrible test" do
end
And then you can exclude those tags at the command line so that your terrible test does not run:
mix test --exclude terrible
So you can make your own tag :pending
and exclude those. If you don't want to have to set the flag at the command line everytime, you can call ExUnit.configure
. This is typically placed in the test/test_helper.exs
file before ExUnit.start()
.
ExUnit.configure(exclude: :pending)
ExUnit.start()
Now your pending tests will not run.
That is how you can use custom tags to skip tests, but you can also just use the built in skip
tag to skip tests.
@tag :skip
test "my terrible test" do
end
Tweet