Unit Testing
Unit tests validate agent structure, logic, and all execution paths through static analysis and mock execution. This enables rapid development iteration with immediate feedback.Overview
Theerdo test command analyzes your agent’s declarative structure and simulates execution without any backend calls:
- Automatically enumerates all execution paths from the agent structure
- Validates template expressions against test data
- Simulates state management and data flow
- Verifies step dependencies
- No LLM API calls needed for validation
What Gets Tested
Execution Path Enumeration
Erdo analyzes your agent’s structure to identify all possible execution paths:- Success with high confidence → memory storage
- Success with low confidence → status notification
- Error → failure notification
Template Validation
Templates are evaluated against generated or provided test data:State Management
The test harness simulates state accumulation across steps:Running Unit Tests
Basic Usage
With Custom Test Data
Provide test data to simulate specific scenarios:Watch Mode
Run tests automatically on file changes:Test Output
Successful Test
Failed Test
Test Data Generation
Automatic Generation
Erdo generates test data from parameter definitions:Custom Test Data
For complex scenarios, provide custom test data:Advanced Features
ITERATE_OVER Testing
Agents usingITERATE_OVER execution mode are tested with array iteration:
Handler Chain Testing
Complex handler chains are fully validated:Nested Step Testing
Steps that invoke other agents are tested recursively:Best Practices
Comprehensive Coverage
Write agents with clear conditional paths:Meaningful Test Data
Provide realistic test data for accurate validation:Iterative Development
Use watch mode during development:Integration with CI/CD
GitHub Actions
Pre-commit Hook
Troubleshooting
Template Hydration Errors
Error:Missing key 'dataset.url' in template data
Solution: Provide the missing field in test data:
State Reference Errors
Error:Field 'previous_step.output' is not available
Solution: Check step dependencies: