pajawa
ExUnit: Expected behaviour with :group + :async true + :parameterize?
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?
Most Liked
ausimian
Popular in Questions
I would like to know what is the best IDE for elixir development?
New
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Credo is smart enough to check for (something like) this:
assert length(the_list) == 0
with this response:
Checking if an enum is empt...
New
Hello everyone,
I try to use an Javascript Event Handler in my root.html.leex file.
Therefore I created a function in the app.js file: ...
New
Other popular topics
Hi,
I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
What learn first? Rust or Elixir
Hi Elixir community!
I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









