Testing
Key Testing Types
The framework supports three test categories:
- Unit tests - Isolated contract logic verification
- Fuzz tests - Randomized input testing
- Fork tests - Mainnet state integration tests
Essential Setup
You’ll need Foundry installed plus environment configuration. The setup requires an Ethereum RPC endpoint, with archive node access recommended for fork testing scenarios.
Running Tests
Unit tests only
forge test -vvv --no-match-test "fork|[fF]uzz"
With fuzz tests
forge test -vvv --no-match-test "fork"
Complete suite
Test Organization
Tests are structured across multiple files covering different components:
- TWAP orders
- StopLoss functionality
- Guards
- Order forwarding
Helper contracts and libraries support the test infrastructure.
Coverage Reporting
Generate reports excluding fork tests:
forge coverage -vvv --no-match-test "fork" --report summary
For detailed HTML output, use the lcov report format with genhtml:
forge coverage -vvv --no-match-test "fork" --report lcov
genhtml lcov.info -o report --branch-coverage
Common Patterns
Tests inherit from BaseComposableCoWTest for access to pre-configured accounts and infrastructure. The documentation includes examples for testing:
- Reverts and error conditions
- Events
- Time-based conditions
- Gas snapshots
Last modified on March 4, 2026