Skip to main content
dbgflow test wraps cargo test and captures a session file for every test annotated with #[dbg_test]. After the run, it prints the paths of all captured sessions and optionally opens the browser UI focused on the first failing test.

What it does

1

Create a timestamped run directory

dbgflow creates artifacts/test-sessions/run-<timestamp>/ (or the directory you specify with --output-dir) to hold all sessions for this run.
2

Run cargo test

dbgflow invokes cargo test with RUST_TEST_THREADS=1 and DBG_SESSION_DIR set to the run directory. Each #[dbg_test] test writes its session as a .json file into that directory.
3

Report captured sessions

After the run completes, dbgflow prints the path of every captured session file. If any test failed, it highlights the session for the first failing test.
4

Serve (optional)

With --serve, dbgflow starts the browser UI loaded with the most relevant session — the first failing test, or the first session if all tests passed. Refreshing the browser re-runs the tests and reloads the session automatically.
dbgflow automatically sets RUST_TEST_THREADS=1 when running your tests. This ensures tests execute sequentially so that session capture is stable and sessions are not interleaved. You do not need to configure this yourself.

Flags

path
Path to the Cargo.toml of the project to test. Useful when you are running dbgflow test from a directory that is not the project root. Omit this flag to test the project in the current directory.
path
Directory where captured sessions are stored. Defaults to artifacts/test-sessions. Each run creates a timestamped subdirectory: run-<unix-timestamp-ms>/.
flag
Start the browser UI after tests complete. Opens the most relevant captured session — the first failing test if any test failed, otherwise the first session. Refreshing the browser re-runs the tests and updates the UI with the new session.
u16
Port for the UI server. Only relevant when --serve is set. Defaults to 3000.
flag
Any arguments after -- are passed directly to cargo test. Use this to filter tests, select a test binary, or pass any other Cargo test flags.

Where sessions are saved

Each invocation of dbgflow test writes sessions into a timestamped subdirectory:
Only tests annotated with #[dbg_test] produce session files. If no sessions are captured, dbgflow reminds you to add the macro.

Usage examples

Test the current project:
Test a specific project by Cargo manifest:
Open the browser UI immediately after tests complete:
Save sessions to a custom directory:
Run only the library tests:
Run a specific integration test:
Combine flags — test a specific project, open the UI, and filter tests:

Live reload with —serve

When you pass --serve, the browser UI stays running after the initial test run. Each time you refresh the page, dbgflow re-runs your tests, captures new sessions, and serves the updated results. This gives you a tight feedback loop while you fix failing tests.
Because --serve re-runs cargo test on every browser refresh, avoid refreshing while you have unsaved changes that could leave your project in an inconsistent state.

Annotating tests for capture

Only tests marked with #[dbg_test] produce session files. Add the macro alongside your existing test attributes:
#[dbg_test] does not support async tests.