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 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.Directory where captured sessions are stored. Defaults to
artifacts/test-sessions. Each run creates a timestamped subdirectory: run-<unix-timestamp-ms>/.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.
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 ofdbgflow test writes sessions into a timestamped subdirectory:
#[dbg_test] produce session files. If no sessions are captured, dbgflow reminds you to add the macro.
Usage examples
Test the current project: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.
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.