Overview
OrcBot uses Vitest for unit and integration testing. This guide covers testing strategies, running tests, and writing new tests for skills and core components.Quick Start
Running Tests
Test Output
Test Structure
File Organization
Test File Template
Testing Strategies
Unit Tests
Test individual functions and classes in isolation. Example: Testing a Parser FunctionIntegration Tests
Test multiple components working together. Example: Testing Agent with MemoryMock Testing
Mock external dependencies (LLM, APIs) for fast, reliable tests. Example: Mocking LLM CallsEnd-to-End Tests
Test the full agent loop with real skills (use sparingly, they’re slow). Example: Testing Full Action ExecutionTesting Skills
Skill Test Template
Testing Web Skills
Mock HTTP Requests:Testing File Skills
Use Temporary Directories:Testing Memory System
Short Memory Tests
Episodic Memory Tests
Vector Memory Tests
Testing Decision Pipeline
Deduplication Tests
Termination Review Tests
Testing Configuration
vitest.config.ts
Test Setup File
Continuous Integration
GitHub Actions
Best Practices
Write Fast Tests
- Mock external APIs
- Use in-memory storage
- Keep test data small
- Parallelize tests
Test Boundaries
- Test error handling
- Test edge cases
- Test invalid inputs
- Test resource limits
Keep Tests Isolated
- No shared state
- Clean up after each test
- Use temp directories
- Reset mocks
Maintain Coverage
- Aim for 80%+ coverage
- Cover critical paths
- Test new features
- Update tests with code changes
Troubleshooting
Tests Timing Out
Symptoms: Tests fail with “Test timeout” error. Solutions:Flaky Tests
Symptoms: Tests pass sometimes, fail other times. Common Causes:- Race conditions
- Shared state between tests
- Network/filesystem timing