Testing
oxide-code uses a 3-layer test pyramid across the workspace to keep default CI fast and deterministic while still verifying real process boundaries and live provider contracts.
Layer 1: Unit Tests
Section titled “Layer 1: Unit Tests”In-module #[cfg(test)] tests cover:
- Pure logic and parsers.
- SQLite
StateStoreandSessionStoreCRUD. - The
Agentloop withScriptedWire. PluginClientprotocol edge cases withScriptedPlugin.ox-acpserve_stdioovertokio::io::duplex.ox-tuiAppstate andrun_loopwithTestBackend.ox-tui-svgrendering.
Layer 2: Offline Integration Tests
Section titled “Layer 2: Offline Integration Tests”Integration tests under tests/*.rs run with zero external network access and exercise cross-crate, OS-process, and wire-serialization boundaries:
crates/ox/tests/cli_run.rs: invokesox runandox sessionsagainst a localwiremockserver, covering tool round-trips,-a/--attachmultimodal payloads, session lifecycle (--continue,--fork,list,delete), and--trustcommand hooks.crates/ox/tests/cli_acp.rs: drivesox acpover real child process stdin/stdout NDJSON againstwiremock, coveringinitialize,session/new,session/prompt,session/cancel, andshutdown.crates/ox-core/tests/plugin_subprocess.rs: exercisesPluginClient::spawnagainst real POSIX shell subprocesses, coveringenvforwarding,tool/call,shutdown, unexpected exit, and timeout cleanup.plugins/ox-plugin-mcp/tests/mcp_bridge.rs: launchesox-plugin-mcpviaPluginClient::spawnagainst a local Streamable HTTP MCPwiremockserver.
Run Layers 1 and 2 together across all workspace crates:
cargo test --all-targetsLayer 3: Opt-in Live Smoke Tests
Section titled “Layer 3: Opt-in Live Smoke Tests”Opt-in integration tests in crates/ox-core/tests/live.rs verify real LLM provider wire contracts. They are marked #[ignore] so default cargo test runs stay offline and deterministic:
live_text_completion: basic streaming text completion.live_tool_call_roundtrip: multi-turn tool call and tool result replay.live_multimodal_image_attachment: inline 1x1 PNGContentBlock::Attachmentencoding.live_streaming_cancellation: dropping an in-flightEventStreamafter the first delta without panic or transport hang.
Run them with a local TOML configuration file (any valid ox config, never committed to the repository):
OX_LIVE_CONFIG=/path/to/config.toml cargo test -p ox-core --test live -- --ignored --nocaptureOX_LIVE_CONFIG(required): path to the TOML configuration file defining providers and models.OX_LIVE_MODEL(optional): model alias to test, overridingdefault_modelin the config file.