I had the same problem today, and I think I have found a possible solution to run the tests at the same time.
I use the technique described here: http://blog.plataformatec.com.br/2015/10/mocks-and-explicit-contracts/ to replace Task.Supervisor during test execution.
Instead:
Task.Supervisor.async_nolink(TaskSupervisor, fn -> (...) end)
I do:
@task_supervisor Application.get_env(:app, :task_supervisor) || Task.Supervisor
and then I define TestTaskSupervisor
defmodule TestTaskSupervisor do def async_nolink(_, fun), do: fun.() end
and add config :app, :task_supervisor, TestTaskSupervisor to config/test.exs .
Thus, I am sure that the task will be executed synchronously and complete before the testing process.
source share