| name | test-runner |
| description | Execute the appropriate test suite (unit, Gherkin, e2e, smoke) and return structured results. Use during Phase 3 (e2e test verification), Phase 4 (red baseline verification), Phase 5 (contract type compilation), Phase 6 (API/Web/integration slices), Phase 7 (smoke tests against deployment), and on resume (re-validate test state). Trigger when running tests, checking test status, or verifying test baselines. |
Test Runner
Execute tests and return structured results for the orchestrator.
Test Commands
| Type | Command |
|---|
| Unit (TypeScript) | cd src/api && npm test |
| Gherkin | npx cucumber-js |
| E2E | npx playwright test --config=e2e/playwright.config.ts |
| Smoke | npx playwright test --grep @smoke |
| All | npm run test:all |
Steps
- Verify Aspire environment (for Gherkin/e2e/smoke/all) — Before running integration tests, ensure the Aspire environment is running:
- Use
aspire describe --format Json (or the Aspire MCP list_resources tool) to check resource status
- If resources are not healthy, run
aspire start + aspire wait api --status healthy + aspire wait web --status healthy
- If resources show errors, use
aspire logs <resource> (or list_console_logs) to diagnose
- Determine test type — Select the test suite based on current phase and task
- Run tests — Execute the command, capture stdout and stderr
- Parse results — Extract pass/fail counts, failure details, and test names
- Detect flaky tests — If a test failed, re-run it once; if it passes on retry, flag as flaky
- Diagnose failures with Aspire MCP — On test failure, use Aspire observability:
list_console_logs for resource stdout/stderr around failure time
list_structured_logs for OpenTelemetry log entries
list_traces to find the failing request's distributed trace
list_trace_structured_logs with the trace ID for full request lifecycle
- Structure output — Format results for the orchestrator
Output Format
Type: unit | gherkin | e2e | smoke | all
Pass: <count>
Fail: <count>
Flaky: <count>
Verdict: GREEN | RED | FLAKY
Failed tests:
- <test name>: <error message>
Aspire MCP Debugging Workflow
When tests fail against the Aspire environment:
1. list_resources → Are all resources Running + Healthy?
2. list_console_logs(resource) → Any errors in stdout/stderr?
3. list_traces(resource) → Find the trace for the failing request
4. list_trace_structured_logs → Full trace lifecycle with all spans
5. execute_resource_command → Restart a resource if stuck
Edge Cases
- Test runner itself fails (not assertions) → report as infrastructure failure
- Aspire resources unhealthy → restart via
aspire start (auto-stops previous)
- Tests exceed 5 minutes → check for hung processes
- Always capture both stdout and stderr