Tracee
Trace function calls in concurrent Elixir processes.
Install / Use
/learn @tagbase-io/TraceeREADME
Tracee
This Elixir library offers functionality to trace and assert expected function calls within concurrent Elixir processes.
This allows you to ensure that destructive and/or expensive functions are only called the expected number of times. For more information, see the Elixir forum post that motivated the development of this library.
Installation
Just add tracee to your list of dependencies in mix.exs:
def deps do
[
{:tracee, "~> 0.2.0", only: :test}
]
end
Usage
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
test "never calls expensive function" do
expect(AnotherModule, :expensive_fun, 1, 0)
assert Module.fun()
end
end
end
License
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
