Running Tests
All Tests
Run the entire test suite:Specific Crate
Test a single crate:Specific Test
Run a specific test by name:MCP Integration Tests
Run MCP tests with replay recording:crates/goose/tests/mcp_replays/.
UI Tests
Test the desktop UI:Test Organization
Unit Tests
Unit tests live alongside the code they test:Integration Tests
Integration tests are in dedicatedtests/ directories:
Writing Tests
Basic Test Structure
Async Tests
Use#[tokio::test] for async tests:
Test Case Macro
Usetest_case for parameterized tests:
Testing Providers
Create a mock provider for testing:MCP Integration Testing
MCP tests verify extension behavior (crates/goose/tests/mcp_integration_test.rs).
Test Structure
Recording MCP Interactions
SetGOOSE_RECORD_MCP=1 to record interactions:
crates/goose/tests/mcp_replays/ and can be used for regression testing.
Test Utilities
goose-test Crate
Provides utilities for testing:goose-test-support Crate
Helpers for integration tests:Testing Extensions
Extension Test Pattern
Testing Best Practices
Prefer Integration Tests
Per project guidelines, prefer tests intests/ directories:
Update Self-Test Recipe
When adding features, updategoose-self-test.yaml:
Use Anyhow for Tests
Test functions can returnResult<()>:
Avoid Flaky Tests
- Don’t rely on timing/sleep
- Use deterministic test data
- Mock external dependencies
- Clean up resources in tests
Test Coverage
Aim to test:- Happy path functionality
- Error cases
- Edge cases (empty input, large input, etc.)
- Async behavior and cancellation
- Resource cleanup
Continuous Integration
Tests run on every PR via GitHub Actions (.github/workflows/ci.yml).
Locally, run the same checks:
cargo fmt- Code formattingcargo clippy- Lintingcargo test- All tests- UI linting
- OpenAPI schema validation
Debugging Tests
Show Test Output
Run Single Test
Enable Logging
Filter Tests
Performance Testing
Local inference performance tests:Next Steps
- Learn Extension Development
- Understand Provider Interface
- Explore Tool Creation