# 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:** ```json { "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:** ```json { "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:** 1. Create job via POST /api/api/jobs 2. Wait for worker to process 3. GET /api/api/jobs/{id} **Expected:** Status changes: pending -> running -> completed #### TC-007: Job Processing - Failure Handling **Steps:** 1. Create job designed to fail 2. Wait for worker to process 3. GET /api/api/jobs/{id} **Expected:** Status is "failed" with error message ### Integration Tests #### TC-008: End-to-End Flow **Steps:** 1. Start API and Worker with Redis 2. POST /api/api/jobs 3. 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