| name | integration-testing |
| description | Creates and runs integration tests for component interactions. Use when testing multiple modules working together. |
Integration Testing
Tests how multiple components work together.
Instructions
When creating integration tests:
-
Identify integration points
- API endpoints
- Database interactions
- Service communication
- External dependencies
-
Set up test environment
- Use test databases
- Mock external services
- Clean state between tests
-
Write test scenarios
#[tokio::test]
async fn test_user_registration_flow() {
let app = spawn_app().await;
let response = app.post_register(json!({
"email": "test@example.com",
"password": "password123"
})).await;
assert!(response.status().is_success());
}
Best Practices
- Test realistic user scenarios
- Use actual databases when possible
- Clean up resources after tests
- Run in isolated environments