1.8 KiB
1.8 KiB
QA Plan: Async Jobs
Feature: async-jobs Status: approved Author: Claude Created: 2026-02-05
Test Scenarios
API Tests
TC-001: Create Job - Success
Endpoint: POST /api/api/jobs Input:
{
"type": "test_job",
"payload": {"key": "value"}
}
Expected: 201 Created with job ID and status "pending"
TC-002: Create Job - Missing Type
Endpoint: POST /api/api/jobs Input:
{
"payload": {"key": "value"}
}
Expected: 400 Bad Request with validation error
TC-003: Get Job - Success
Endpoint: GET /api/api/jobs/{id} Precondition: Job exists Expected: 200 OK with job details
TC-004: Get Job - Not Found
Endpoint: GET /api/api/jobs/{unknown-id} Expected: 404 Not Found
TC-005: Get Job - Invalid ID Format
Endpoint: GET /api/api/jobs/invalid-uuid Expected: 400 Bad Request
Worker Tests
TC-006: Job Processing - Success
Steps:
- Create job via POST /api/api/jobs
- Wait for worker to process
- GET /api/api/jobs/{id} Expected: Status changes: pending -> running -> completed
TC-007: Job Processing - Failure Handling
Steps:
- Create job designed to fail
- Wait for worker to process
- GET /api/api/jobs/{id} Expected: Status is "failed" with error message
Integration Tests
TC-008: End-to-End Flow
Steps:
- Start API and Worker with Redis
- POST /api/api/jobs
- Poll GET /api/api/jobs/{id} until completed Expected: Job completes within expected time
Test Environment
- Redis running locally or in CI
- API service running on port 8001
- Worker running and connected to same Redis
Success Criteria
- All test cases pass
- No race conditions in concurrent job processing
- Proper error handling and status codes