ExUnit: How to find your synchronous test suites

Joel Kemp
Elixir Learnings
Published in
2 min readFeb 8, 2022

I had an ExUnit run output on Elixir 1.12 that listed out the async test times and the sync test times. I wanted to find which test suites that were sync, but the project was too large to spot check every single suite.

Test run showing async and sync test times

I couldn’t find an ExUnit option that would list that information and I dug through the ExUnit source code to see if there was some undocumented feature. No luck. What I did find was that in the ExUnit.Server module, there are these add methods for sync and async tests:

ExUnit.Server module’s methods for registering test suites/modules

So I thought of using trusty RexBug to trace that module to see if the add_sync_module method was being called at all.

I added Rexbug.start("ExUnit.Server.add_sync_module/_") at the top of my test_helper.exs file and then ran mix test .

It worked!! During my test run, I saw the following calls:

ExUnit run showing the traced sync test suites

All that was left was going to those suites and adding async: true .

--

--