I am trying to run a parameterize’d test with both a :group set and async: true.
The ExUnit docs state: “If both :async and :parameterize are given, the different parameters run concurrently”.
I would expect this to still apply even if a :group is supplied, however, it appears that all parameterized tests use the same group, and they end up running serially.
e.g.
defmodule ParamAsyncGroupTest do
use ExUnit.Case,
group: :some_group,
async: true,
parameterize: [%{param: :a}, %{param: :b}, %{param: :c}, %{param: :d}]
test "testing with param", ctx do
IO.inspect("Testing param: #{ctx.param}")
Process.sleep(5_000)
assert true
end
end
% mix test
Running ExUnit with seed: 856650, max_cases: 16
"Testing param: d"
."Testing param: c"
."Testing param: b"
."Testing param: a"
.
Finished in 20.0 seconds (20.0s async, 0.00s sync)
4 tests, 0 failures
If I remove the :group then the tests run in parallel:
defmodule ParamAsyncGroupTest do
use ExUnit.Case,
# group: :some_group,
async: true,
parameterize: [%{param: :a}, %{param: :b}, %{param: :c}, %{param: :d}]
test "testing with param", ctx do
IO.inspect("Testing param: #{ctx.param}")
Process.sleep(5_000)
assert true
end
end
% mix test
Running ExUnit with seed: 162988, max_cases: 16
"Testing param: d"
"Testing param: c"
"Testing param: a"
"Testing param: b"
....
Finished in 5.0 seconds (5.0s async, 0.00s sync)
4 tests, 0 failures
Thoughts on this?






















