| name | integration-testing |
| description | Test integration points early. Verify cross-service contracts, API boundaries, and data flow before declaring done. |
Integration Testing Protocol
Rules for verifying that cross-cutting features work before building on top of them.
Auth Must Be Verified Before Feature Development
Authentication is the most common source of cascading failures in multi-agent builds. Auth issues that go undetected compound as more features depend on protected routes.
After implementing auth (any strategy):
-
Verify the auth flow end-to-end:
- Login succeeds with valid credentials
- Login fails with invalid credentials
- Protected routes redirect unauthenticated users
- Session persists across page navigation
- Logout clears the session
-
Verify admin access (if applicable):
- Admin routes are accessible only to admin users
- Non-admin users are redirected or shown a 403
- The admin check works with the actual session token, not a mock
-
Do not build features on top of auth until the flow is verified. Building protected pages before confirming auth works leads to multi-session debugging cycles.
API Contract Verification
After implementing backend services or API routes:
- Test each endpoint with a real request (not just type-checking).
- Verify that request/response shapes match the contracts defined in the plan.
- Verify error responses (404, 400, 401, 500) return the expected format.
- If using an ORM, verify that database queries return the expected data shape.
Frontend-Backend Integration
After connecting frontend to backend:
- Verify that UI components call the correct API endpoints.
- Verify that loading states, error states, and empty states all render.
- Verify that mutations (create, update, delete) reflect in the UI without a page refresh.
- Check the browser console for errors — especially hydration mismatches in SSR frameworks.
Cross-Agent Integration
When multiple agents have worked in parallel:
- Check shared types — do both sides agree on the shape of shared data?
- Check imports — are agents importing from the correct paths?
- Check database state — if one agent created schema and another wrote queries, do they match?
- Run the full app — not just individual modules.
Framework Version Awareness
Modern frameworks change APIs between versions. When using any framework:
- Check the installed version before using framework-specific APIs.
- Verify against the framework's migration guide for the specific version in use.
- Common traps to watch for:
- APIs that became async between versions (e.g., route params as Promises)
- SSR/hydration behavior changes
- Import path changes between major versions
- Deprecated APIs that still compile but fail at runtime
When to Create Smoke Test Scripts
For features that are difficult to verify manually or that have failed repeatedly, create a simple test script:
echo "Testing auth flow..."
curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/login
curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/admin
echo "Auth smoke test complete."
Save these in scripts/ or tests/ for reuse across sessions.
Demo / Example Application Verification
When a build phase creates or modifies a demo or example application:
- Exercise every exposed endpoint after the app starts. Use curl or the project's test
framework.
- Verify responses are non-empty. Empty arrays (
[]), null, or empty objects ({}) indicate
a stub that was never implemented. Stubs MUST be replaced with meaningful sample data before
commit.
- Verify PII exclusion (if applicable). Ensure sensitive fields declared as hidden are absent
from the response.
- Log the verification output in the build summary so the reviewer can confirm.
Common trap: demo services with stub methods (e.g., return List.of()) that compile and pass
type checks but return nothing at runtime. The type checker cannot catch this — only an actual
HTTP request reveals it.