Quick Start
Run All Tests
Run Tests with Logging
Run Specific Tests
Test Categories
Unit Tests
Unit tests are located in the same file as the code they test:Integration Tests
Integration tests are in thetests/ directory:
Feature-Gated Tests
Some tests require specific features:Database Testing
libSQL (Default)
Tests use embedded libSQL by default - no setup required:PostgreSQL Integration Tests
For PostgreSQL-specific tests:Test Containers
Some integration tests use testcontainers for PostgreSQL:Test Organization
Module Tests
Tests in the same file as the code:Separate Test Files
Large test suites intests/:
Writing Tests
Basic Test Structure
Async Tests
Testing Errors
Testing with Mock Data
Snapshot Testing
IronClaw uses insta for snapshot testing:Test Utilities
Test Fixtures
Create reusable test data:Pretty Assertions
For better diff output:Running Specific Test Suites
All Tests
Library Tests Only
Integration Tests Only
Doc Tests
Benchmarks
All Targets
Test Configuration
Parallel Execution
Test Timeout
Ignore Tests
Coverage
Install Coverage Tool
Generate Coverage Report
Coverage with Specific Features
CI Coverage
Continuous Integration
GitHub Actions
IronClaw uses GitHub Actions for CI:Local CI Testing
Run the same tests as CI:Benchmarking
Criterion Benchmarks
For performance testing:Debugging Tests
Run with Debugger
Print Debugging
Conditional Logging
Best Practices
Test Naming
Arrange-Act-Assert Pattern
Test Independence
Each test should be independent:Use Test Helpers
Common Test Patterns
Testing Result Types
Testing Option Types
Testing Panics
Troubleshooting
Test Database Conflicts
Issue: Tests fail due to database conflicts Solution: Use isolated test databasesFlaky Tests
Issue: Tests pass/fail intermittently Solutions:- Check for race conditions
- Use proper synchronization
- Avoid time-dependent tests
- Make tests deterministic
Slow Tests
Issue: Test suite takes too long Solutions:Next Steps
- Read: Contributing Guide
- Review: Feature Parity
- Build: Building from Source