DEV Community

Srikanth Kyatham
Srikanth Kyatham

Posted on

Debugging with breakpoints in ExUnit

Hi

The following is a demonstration on how to debug using debugger. Of course, IO.inspect works. Where it does not.

defmodule Math do
  def add(a, b) do
    a + b
  end
end
Enter fullscreen mode Exit fullscreen mode
defmodule MathTest do

  # timeout: :infinity is needed as the exunit timeouts around 3 seconds 
  @tag timeout: :infinity
  test ~c"test add" do
    :debugger.start()
    :int.ni(Math)
    # break_in take module, function, arity
    # module - Math
    # function - add
    # arity - 2 no of parameters
    :int.break_in(Math, :add, 2)
  end
end
Enter fullscreen mode Exit fullscreen mode

Top comments (0)