DEV Community

Cover image for Run only one test in Elixir
Mykolas Mankevicius
Mykolas Mankevicius

Posted on

Run only one test in Elixir

Add a tag for e.g. @tag runnable: true at the top of the test you want to run, like bellow:

  @tag runnable: true # <-- this bit
  test "run only this test" do
    assert true
  end
Enter fullscreen mode Exit fullscreen mode

Then run the mix test task with the --only option like:

  $ mix test --only runnable:true
Enter fullscreen mode Exit fullscreen mode

Note: there is no space between the tag name: runnable with a colon and the value: true resulting in runnable:true

If you want other options theres a great post on medium:
Elixir testing: running only specific tests

Oldest comments (0)