Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Testing Guide

Comprehensive test coverage for OpenCrabs. All tests run with:

cargo test --all-features

Quick Reference

CategoryTestsLocation
Brain — Agent Service42src/brain/agent/service.rs
Brain — Prompt Builder20src/brain/prompt_builder.rs
Brain — Agent Context12src/brain/agent/context.rs
Brain — Provider (Anthropic)9src/brain/provider/anthropic.rs
Brain — Provider (Retry)9src/brain/provider/retry.rs
Brain — Provider (Custom OpenAI)9src/brain/provider/custom_openai_compatible.rs
Brain — Provider (Factory)4src/brain/provider/factory.rs
Brain — Provider (Types/Error/Trait)7src/brain/provider/
Brain — Tokenizer8src/brain/tokenizer.rs
Brain — Commands6src/brain/commands.rs
Brain — Self-Update1src/brain/self_update.rs
Brain Tools — Plan Security20src/brain/tools/plan_tool.rs
Brain Tools — Exa Search18src/brain/tools/exa_search.rs
Brain Tools — Write File17src/brain/tools/write_opencrabs_file.rs
Brain Tools — A2A Send16src/brain/tools/a2a_send.rs
Brain Tools — Load Brain File14src/brain/tools/load_brain_file.rs
Brain Tools — Brave Search12src/brain/tools/brave_search.rs
Brain Tools — Doc Parser10src/brain/tools/doc_parser.rs
Brain Tools — Registry7src/brain/tools/registry.rs
Brain Tools — Slash Command6src/brain/tools/slash_command.rs
Brain Tools — Bash6src/brain/tools/bash.rs
Brain Tools — Write/Read/Config/Memory/Error16src/brain/tools/
Channels — Voice Service14src/channels/voice/service.rs
Channels — Voice Local TTS14src/channels/voice/local_tts.rs
Channels — Voice Local Whisper25src/channels/voice/local_whisper.rs
Channels — Commands14src/channels/commands.rs
Channels — WhatsApp Store15src/channels/whatsapp/store.rs
Channels — WhatsApp Handler5src/channels/whatsapp/handler.rs
Channels — Telegram Handler8src/channels/telegram/handler.rs
Channels — Slack Handler2src/channels/slack/handler.rs
Channels — Discord Handler2src/channels/discord/handler.rs
Channels — General5src/channels/
Config — Types19src/config/types.rs
Config — Secrets5src/config/secrets.rs
Config — Update4src/config/update.rs
Config — Crabrace3src/config/crabrace.rs
DB — Repository (Plan)15src/db/repository/plan.rs
DB — Retry8src/db/retry.rs
DB — Database5src/db/database.rs
DB — Models4src/db/models.rs
DB — Repository (Other)9src/db/repository/
Services — Plan11src/services/plan.rs
Services — File11src/services/file.rs
Services — Message10src/services/message.rs
Services — Session9src/services/session.rs
Services — Context2src/services/context.rs
A2A — Debate8src/a2a/debate.rs
A2A — Types6src/a2a/types.rs
A2A — Server/Handler/Agent Card7src/a2a/
Memory — Store6src/memory/store.rs
Memory — Search3src/memory/search.rs
Pricing7src/pricing.rs
Logging4src/logging/logger.rs
Utils — Install6src/utils/install.rs
Utils1src/utils/
CLI1src/cli.rs
Tests — CLI Parsing28src/tests/cli_test.rs
Tests — Cron Jobs & Scheduling49src/tests/cron_test.rs
Tests — Channel Search24src/tests/channel_search_test.rs
Tests — Voice STT Dispatch7src/tests/voice_stt_dispatch_test.rs
Tests — Voice Onboarding7src/tests/voice_onboarding_test.rs
Tests — Candle Whisper6src/tests/candle_whisper_test.rs
Tests — Evolve (Self-Update)16src/tests/evolve_test.rs
Tests — Session & Working Dir15src/tests/session_working_dir_test.rs
Tests — Message Compaction24src/tests/compaction_test.rs
Tests — Fallback Vision35src/tests/fallback_vision_test.rs
Tests — General100src/tests/
Tests — File Extract10src/tests/file_extract_test.rs
Tests — Image Utils9src/tests/image_util_test.rs
Tests — Onboarding Brain16src/tests/onboarding_brain_test.rs
Tests — Onboarding Navigation22src/tests/onboarding_navigation_test.rs
Tests — Onboarding Types19src/tests/onboarding_types_test.rs
Tests — Plan Document15src/tests/plan_document_test.rs
Tests — TUI Error16src/tests/tui_error_test.rs
Tests — Queued Messages15src/tests/queued_message_test.rs
Total1,118

Feature-Gated Tests

Some tests only compile/run with specific feature flags:

FeatureTests
local-sttLocal whisper inline tests, candle whisper tests, STT dispatch local-mode tests, codec tests, availability cycling tests
local-ttsTTS voice cycling, Piper voice Up/Down

All feature-gated tests use #[cfg(feature = "...")] and are automatically included when running with --all-features.


Running Tests

# Run all tests (recommended)
cargo test --all-features

# Run a specific test module
cargo test --all-features -- voice_onboarding_test

# Run a single test
cargo test --all-features -- is_newer_major_bump

# Run with output (for debugging)
cargo test --all-features -- --nocapture

# Run only local-stt tests
cargo test --features local-stt -- local_whisper

Disabled Test Modules

These modules exist but are commented out in src/tests/mod.rs (require network or external services):

ModuleReason
error_scenarios_testRequires mock API server
integration_testEnd-to-end with LLM provider
plan_mode_integration_testEnd-to-end plan workflow
streaming_testRequires streaming API endpoint