Documentation
Testing
Test handlers, middleware, and integrations confidently.
Overview
Use table tests and httptest servers to validate behavior end-to-end.
Example
Go
req := httptest.NewRequest(http.MethodGet, "/health", nil)
res := httptest.NewRecorder()
app.ServeHTTP(res, req)Best Practices
- Test success and failure paths together.
- Use fixture builders for readable tests.
Common Pitfalls
- Only testing happy paths.
- Mocking too much and missing integration issues.