Execute comprehensive integration and end-to-end tests for story validation.
Executes comprehensive integration and end-to-end tests for story validation.
/plugin marketplace add ninthspace/claude-code-marketplace/plugin install sdd@ninthspace-marketplaceExecute comprehensive integration and end-to-end tests for story validation.
Category: Testing & Validation
Format: Imperative (Comprehensive)
Execution Time: 3-8 minutes
Prerequisites: Active story in /docs/stories/development/ or /docs/stories/review/
Destructive: No (read-only with test execution)
Related Commands:
/sdd:story-quick-check - Fast validation before integration tests/sdd:story-full-check - Comprehensive validation suite (includes this + more)/sdd:story-validate - Final story validation (runs after this)Context Requirements:
/docs/project-context/technical-stack.md (testing tools, frameworks, database)/docs/project-context/coding-standards.md (test patterns, coverage requirements)/docs/project-context/development-process.md (integration testing criteria)Story Parameters:
# Auto-detect from current active story or specify:
--story-id=STORY-XXX-NNN # Specific story ID
--scope=api|db|e2e|all # Test scope (default: all)
--performance # Include performance profiling
Test Configuration:
--browser=chrome|firefox|safari # Browser for e2e tests (default: chrome)
--parallel=N # Parallel test execution (default: 4)
--coverage # Generate coverage report
--verbose # Detailed test output
Load Context:
# Verify project context exists
if ! [ -d /docs/project-context/ ]; then
echo "β οΈ Missing /docs/project-context/ - run /sdd:project-init first"
exit 1
fi
# Load testing requirements
source /docs/project-context/technical-stack.md # Testing tools
source /docs/project-context/coding-standards.md # Test patterns
source /docs/project-context/development-process.md # Integration criteria
Identify Test Scope:
Output:
π― INTEGRATION TEST SCOPE
========================
Story: STORY-XXX-NNN - [Title]
Integration Points:
β API: POST /api/tasks, GET /api/tasks/{id}
β Database: tasks, categories, task_category pivot
β Livewire: TaskManager component
β Browser: Task creation workflow
Test Types: API, Database, E2E, Performance
Estimated Duration: ~5 minutes
Execute API Tests:
# Laravel/Pest example
php artisan test --filter=Api --coverage
# Check:
β Endpoint functionality (CRUD operations)
β Request/response formats (JSON, validation)
β Authentication/authorization (gates, policies)
β Error responses (422, 404, 403, 500)
β Rate limiting (if configured)
Output:
π API INTEGRATION TESTS
=======================
β
POST /api/tasks creates task (24ms)
β
GET /api/tasks returns all tasks (18ms)
β
PUT /api/tasks/{id} updates task (22ms)
β
DELETE /api/tasks/{id} removes task (19ms)
β POST /api/tasks validates input (FAILED)
Expected 422, got 500
Error: Column 'order' cannot be null
Passed: 4/5 (80%)
Failed: 1
Duration: 0.8s
Execute Database Tests:
# Test database operations
php artisan test --filter=Database
# Check:
β CRUD operations (create, read, update, delete)
β Transactions (rollback, commit)
β Data integrity (constraints, foreign keys)
β Migrations (up, down, fresh)
β Relationships (eager loading, N+1 prevention)
Output:
πΎ DATABASE INTEGRATION
======================
β
Task model creates records (12ms)
β
Categories relationship loads (8ms)
β
Soft deletes work correctly (10ms)
β
Order column maintains sequence (15ms)
β
Transaction rollback on error (18ms)
Passed: 5/5 (100%)
Duration: 0.6s
Query Performance:
Average: 8ms
Slowest: Task::with('categories') - 15ms
Execute Browser Tests:
# Pest v4 Browser Testing
php artisan test --filter=Browser --browser=chrome
# Test workflows:
β Complete user workflows (login β create β edit β delete)
β Multi-step processes (task creation with categories)
β Cross-feature interactions (filtering + sorting)
β Data flow validation (form β server β database β UI)
Output:
π END-TO-END TESTS (Chrome)
===========================
β
User can create task with category (2.4s)
β
Task displays in correct order (1.8s)
β
Drag-and-drop reorders tasks (3.1s)
β Mobile touch gestures work (FAILED)
Element not found: [wire:sortable]
Screenshot: /tmp/mobile-touch-fail.png
Passed: 3/4 (75%)
Failed: 1
Duration: 8.2s
Console Errors: None
Network Errors: None
Execute Performance Tests (if --performance flag):
# Load testing
ab -n 100 -c 10 https://ccs-todo.test/api/tasks
# Check:
β API response times (< 200ms p95)
β Database query performance (< 50ms avg)
β Memory usage (< 128MB)
β Stress test critical paths (100 concurrent users)
Output:
β‘ PERFORMANCE PROFILING
=======================
API Endpoints:
GET /api/tasks avg: 45ms p95: 120ms β
POST /api/tasks avg: 68ms p95: 180ms β
PUT /api/tasks/{id} avg: 52ms p95: 150ms β
Database Queries:
Average: 12ms
Slowest: Task::with('categories', 'tags') - 48ms
Memory Usage: 64MB (peak: 82MB) β
Bottlenecks: None detected
Generate Comprehensive Report:
π INTEGRATION TEST RESULTS
===========================
Story: STORY-XXX-NNN - [Title]
Executed: 2025-10-01 14:32:15
Duration: 5m 12s
OVERALL: π‘ PASSING WITH WARNINGS
βββββββββββββββββββββββ¬βββββββββ¬βββββββββ¬ββββββββββ¬βββββββββββ
β Test Suite β Passed β Failed β Skipped β Coverage β
βββββββββββββββββββββββΌβββββββββΌβββββββββΌββββββββββΌβββββββββββ€
β API Integration β 4 β 1 β 0 β 92% β
β Database Integrationβ 5 β 0 β 0 β 88% β
β E2E Browser β 3 β 1 β 0 β 76% β
β Performance β N/A β N/A β N/A β N/A β
βββββββββββββββββββββββΌβββββββββΌβββββββββΌββββββββββΌβββββββββββ€
β TOTAL β 12 β 2 β 0 β 85% β
βββββββββββββββββββββββ΄βββββββββ΄βββββββββ΄ββββββββββ΄βββββββββββ
β FAILED TESTS (2):
1. POST /api/tasks validates input
Error: Column 'order' cannot be null
Fix: Add default value to 'order' column in migration
2. Mobile touch gestures work
Error: Element not found: [wire:sortable]
Fix: Ensure SortableJS loads on mobile viewport
Screenshot: /tmp/mobile-touch-fail.png
β οΈ WARNINGS (1):
- Slowest query: Task::with('categories', 'tags') - 48ms
Consider adding indexes or reducing eager loading
β
HIGHLIGHTS:
β All database operations working correctly
β API authentication/authorization passing
β Desktop E2E workflows functional
β Performance within acceptable ranges
π COVERAGE: 85% (target: 80%+)
Lines: 342/402
Branches: 28/35
Functions: 45/48
π― NEXT STEPS:
1. Fix: Add default order value in migration
2. Fix: Debug mobile touch gesture handling
3. Re-run: php artisan test --filter="failed"
4. Then run: /sdd:story-validate
Interactive Failure Resolution:
β 2 TEST FAILURES DETECTED
Would you like me to:
[1] Show detailed error logs
[2] Suggest fixes for each failure
[3] Implement fixes automatically
[4] Re-run failed tests only
[5] Exit (fix manually)
Choose option [1-5]:
If Option 2 (Suggest Fixes):
π§ SUGGESTED FIXES
==================
Failure 1: POST /api/tasks validates input
Problem: Column 'order' has no default value
Location: database/migrations/xxx_create_tasks_table.php
Fix:
$table->integer('order')->default(0);
Confidence: HIGH (common pattern)
Failure 2: Mobile touch gestures
Problem: SortableJS not loading on mobile
Location: resources/js/app.js
Fix: Check Alpine.js device detection:
if (window.isDevice('mobile') || window.isDevice('tablet')) {
loadSortable();
}
Confidence: MEDIUM (requires investigation)
Apply fixes? [y/n]:
If Option 3 (Auto-fix):
Update Story Documentation:
# Append to story's progress log
echo "$(date): Integration tests executed" >> /docs/stories/development/STORY-XXX-NNN.md
# Add test results section
cat >> /docs/stories/development/STORY-XXX-NNN.md <<EOF
## Integration Test Results ($(date +%Y-%m-%d))
**Status**: π‘ Passing with warnings
**Duration**: 5m 12s
**Coverage**: 85%
### Test Summary
- API Integration: 4/5 passed (1 failed)
- Database Integration: 5/5 passed
- E2E Browser: 3/4 passed (1 failed)
### Failed Tests
1. POST /api/tasks validation - Fixed: Added default order value
2. Mobile touch gestures - In Progress: Debugging SortableJS loading
### Next Actions
- Fix remaining mobile touch issue
- Re-run tests
- Proceed to /sdd:story-validate
EOF
Output:
π STORY UPDATED
===============
Progress log updated: /docs/stories/development/STORY-XXX-NNN.md
Test results recorded
Timestamp: 2025-10-01 14:37:27
$ /sdd:story-test-integration
π― Integration Test Scope: STORY-DUE-002
API + Database + E2E + Performance
[... test execution ...]
π INTEGRATION TEST RESULTS
===========================
OVERALL: β
ALL TESTS PASSING
Total: 15 tests passed (0 failed)
Coverage: 92%
Duration: 4m 38s
β
Ready for /sdd:story-validate
$ /sdd:story-test-integration
[... test execution ...]
β 2 failures detected
Applying auto-fixes...
β Fixed migration default value
β Updated SortableJS loading
Re-running failed tests...
β
POST /api/tasks validates input (FIXED)
β
Mobile touch gestures work (FIXED)
π FINAL RESULTS: β
ALL TESTS PASSING
$ /sdd:story-test-integration --scope=api
π― Integration Test Scope: API only
π API INTEGRATION TESTS
=======================
β
All 8 API tests passed
Duration: 1m 12s
β
API integration validated
$ /sdd:story-test-integration --performance
[... test execution ...]
β‘ PERFORMANCE PROFILING
=======================
β οΈ Bottleneck detected:
GET /api/tasks with 100+ categories
Response time: 450ms (target: <200ms)
Recommendation:
- Add pagination (limit 25 per page)
- Cache category counts
- Add database indexes
Would you like me to implement optimizations? [y/n]:
Command succeeds when:
Command fails when:
Generated Reports:
/docs/stories/development/STORY-XXX-NNN.md/tmp/test-failure-*.png (if applicable)/tests/coverage/ (if --coverage flag)No New Files Created: This command only executes tests and updates existing story documentation.
--performance flag--parallel=N for faster executionBest Practices:
/sdd:story-quick-check first for fast validation--scope to test specific areas during development/sdd:story-validateNext Steps After Success:
β
Integration tests passing β /sdd:story-validate
β οΈ Minor warnings β Fix, re-run, then /sdd:story-validate
β Critical failures β Fix issues, re-run this command