Tracee - Trace function calls in concurrent Elixir processes

Hey, super proud to announce Tracee, a library that allows to trace and assert expected function calls within concurrent Elixir processes. I had a very particular problem that is explained in this forum post, and after like 6 rewrites tests are green and I’m happy with the API :blush:

Hex.pm: tracee | Hex
Source Code: GitHub - tagbase-io/tracee: Trace function calls in concurrent Elixir processes.
Documentation: Tracee v0.1.0 — Documentation

See this example how do use it:

defmodule ModuleTest do
  use ExUnit.Case

  import Tracee

  setup :verify_on_exit!

  describe "fun/0" do
    test "calls expensive function only once" do
      expect(AnotherModule, :expensive_fun, 1)

      assert Module.fun()
    end

    test "calls expensive function only once from another process" do
      expect(AnotherModule, :expensive_fun, 1)

      assert fn -> Module.fun() end
             |> Task.async()
             |> Task.await()
    end
  end
end
8 Likes