1

I'm trying to imitate separate Unit and Integration tests in Elixir project. For Unit tests I don't need Supervision tree running, so ideally I'd like to use something like module tag, i.e. @moduletag :integration which would group tests that require an App running. I can do it manually running tests twice:

mix test --no-start --only integration:false
mix test --only integration:true

But I'd prefer some integrated solution so that I would have to just run mix test. There are options, such as start and autorun for ExUnit.configure/start, but they don't seem to cause any effect. Any suggestions?

Ivan Yurov
  • 1,578
  • 10
  • 27

1 Answers1

0

You can create an alias in the mix.exs that will run your test suite.

# also add "aliases: aliases()" to project/0 list
defp aliases do
  [testproj: ["test --no-start --only integration:false", "test --only integration:true"]]
end

Then try in your project directory: mix testproj

Lachezar
  • 6,523
  • 3
  • 33
  • 34
  • Yup, doesn't seem to work. But it still feels like a workaround, the main point of the question was how to actually use ExUnit.configure to control tests. I would naively suggest that if there's run function and autorun option, then it must be possible to run tests manually twice with different params from one point. – Ivan Yurov Oct 17 '17 at 14:21