Documentation Index
Fetch the complete documentation index at: https://cowswap-mintlify-docs-quality-audit-1774257282.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Testing
This guide covers the testing infrastructure and practices for CoW Protocol Services.Test Categories
Unit Tests
Validate individual functions without external dependencies.Database Tests
Require PostgreSQL and must run serially to avoid race conditions. Prerequisites:- Start Docker Compose:
docker compose up -d db - Use the
--test-threads 1flag
End-to-End Tests
Two types of E2E tests:Local Node Tests
Deploy contracts on a clean Ethereum node:Forked Network Tests
Require setting environment variables for RPC endpoints:Documentation Tests
Verify code examples in comments stay current:Driver Tests
Require increased stack size due to complex simulation requirements:Running Tests Locally
Summary ofjust commands for each test type:
| Command | Description |
|---|---|
just test-unit | Unit tests |
just test-db | Database tests |
just test-e2e-local | Local E2E tests |
just test-e2e-forked | Forked network tests |
just test-driver | Driver tests |
Best Practices
- Keep tests fast
- Test one behavior per test
- Use descriptive names like
test_order_fails_when_expired - Avoid flaky tests dependent on timing or external state
- Write tests before implementation when possible
Troubleshooting
Using cargo test Instead of cargo nextest
Tests may pass with cargo test but fail in CI. Always use cargo nextest run.