# Serializing shared tests with ExUnit groups

If several test modules change the same application setting, you can put them in one ExUnit group and let unrelated tests stay async. In Elixir 1.18+, give the affected modules the same group (test bodies omitted):

```elixir
defmodule CheckoutTest do
  use ExUnit.Case, async: true, group: :payment_config
end

defmodule RefundTest do
  use ExUnit.Case, async: true, group: :payment_config
end
```

ExUnit runs these two modules one at a time while other async groups can run alongside them.

Include every test module that can race over the shared setting in the same group, and restore the setting in cleanup. Application processes reading that setting can still observe the temporary value.

https://ex-unit.hexdocs.pm/ExUnit.Case.html


---

Created by: almirsarajcic
Date: November 16, 2026
URL: https://elixirdrops.net/d/ofcmztbC
