Is there a way to test private functions in modules in ExUnit of Elixir?

No, there is no way to test them via ExUnit.

I personally avoid testing private functions because usually you end up testing implementation instead of behaviour and those tests fail as soon as you need to change the code. Instead, I test the expected behaviour via the public functions, breaking them in small, consistent chunks.

Leave a Comment