pm4exunit

Process-conformance and latency assertions for ExUnit. Record the events your code emits during a test, then assert that the trace follows an allowed process model and meets its time limits.

defmodule OrderSagaTest do
  use ExUnit.Case
  use Pm4ExUnit

  test "order saga follows the model", %{pm4_session: session} do
    emit_event(session, "e1", :order_created)
    emit_event(session, "e2", :payment_processed)
    emit_event(session, "e3", :order_fulfilled)

    assert_conformance(session, [[:order_created, :payment_processed, :order_fulfilled]])
  end
end

Install

def deps do
  [{:pm4exunit, "~> 26.11", only: :test}]
end

Requires Elixir 1.15 or later. No runtime dependencies.

What it does

Replay semantics port the pm4vitest TBR engine, so the same model and trace score identically in both. This is verified by test/pm4exunit_cross_engine_vector_test.exs.

Documentation

The docs follow Diátaxis. Start at docs/README.md.

You want to Read
Learn by doing Tutorials
Solve a specific task How-to guides
Look up an API Reference
Understand the model Explanation

Known limitations

The docs/ directory ships with the hex package and is rendered on HexDocs.

License

MIT. See LICENSE.