Skip to content

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.

In-module #[cfg(test)] tests cover:

  • Pure logic and parsers.
  • SQLite StateStore and SessionStore CRUD.
  • The Agent loop with ScriptedWire.
  • PluginClient protocol edge cases with ScriptedPlugin.
  • ox-acp serve_stdio over tokio::io::duplex.
  • ox-tui App state and run_loop with TestBackend.
  • ox-tui-svg rendering.

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: invokes ox run and ox sessions against a local wiremock server, covering tool round-trips, -a / --attach multimodal payloads, session lifecycle (--continue, --fork, list, delete), and --trust command hooks.
  • crates/ox/tests/cli_acp.rs: drives ox acp over real child process stdin/stdout NDJSON against wiremock, covering initialize, session/new, session/prompt, session/cancel, and shutdown.
  • crates/ox-core/tests/plugin_subprocess.rs: exercises PluginClient::spawn against real POSIX shell subprocesses, covering env forwarding, tool/call, shutdown, unexpected exit, and timeout cleanup.
  • plugins/ox-plugin-mcp/tests/mcp_bridge.rs: launches ox-plugin-mcp via PluginClient::spawn against a local Streamable HTTP MCP wiremock server.

Run Layers 1 and 2 together across all workspace crates:

Terminal window
cargo test --all-targets

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 PNG ContentBlock::Attachment encoding.
  • live_streaming_cancellation: dropping an in-flight EventStream after 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):

Terminal window
OX_LIVE_CONFIG=/path/to/config.toml cargo test -p ox-core --test live -- --ignored --nocapture
  • OX_LIVE_CONFIG (required): path to the TOML configuration file defining providers and models.
  • OX_LIVE_MODEL (optional): model alias to test, overriding default_model in the config file.