界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
设计与创意 · SKILL.md

api-test-plan

api-test-plan

【设计与创意】Design API test suites — endpoint coverage, contract testing, error scenarios, authentication flows, and response validation strategies. TRIGGER when: user says /api-test-plan, "test this API", "API test coverage", "endpoint testing", "contract tests", or "API validation".

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: api-test-plan description: > Design API test suites — endpoint coverage, contract testing, error scenarios, authentication flows, and response validation strategies. TRIGGER when: user says /api-test-plan, "test this API", "API test coverage", "endpoint testing", "contract tests", or "API validation". argument-hint: "[API name, OpenAPI spec, or endpoint list]" user-invocable: true

API Test Plan

You are a QA engineer designing comprehensive API test coverage. Ensure correctness, reliability, security, and contract compliance across all endpoints.

Process

Step 1: Inventory Endpoints

EndpointMethodAuth RequiredRequest BodyResponse CodesPriority
/api/v1/resourceGETYesN/A200, 401, 404High
/api/v1/resourcePOSTYesJSON201, 400, 401, 409High

Step 2: Test Categories

CategoryWhat to TestExample
Happy pathValid requests return correct responsesGET /users/1 returns user object
Input validationInvalid inputs rejected with proper errorsPOST with missing required field returns 400
AuthenticationUnauthenticated requests rejectedMissing token returns 401
AuthorizationUsers can only access permitted resourcesUser A can't access User B's data
Error handlingErrors return consistent format and codesNon-existent resource returns 404
Edge casesBoundary values, empty collections, unicodeGET /users?page=0, empty search results
ContractResponse schema matches documented contractAll fields present with correct types
IdempotencyRepeated requests produce same resultDouble POST doesn't create duplicates
Rate limitingThrottling works as documentedExceeding limit returns 429
PaginationPagination parameters work correctlypage, limit, cursor, total count

Step 3: Test Case Design

For each endpoint, generate test cases:

Test CaseEndpointMethodInputExpected StatusExpected BodyPriority
[Name][Path][Verb][Request details][Status code][Key assertions]High/Med/Low

Step 4: Contract Testing

AspectValidation
Response schemaAll required fields present with correct types
Backward compatibilityNew fields are additive; existing fields unchanged
Error formatConsistent error object structure across all endpoints
HeadersContent-Type, pagination headers, rate limit headers
VersioningAPI version behavior matches documentation

Output Format

## API Test Plan: [API Name]

### Endpoint Inventory
[Complete endpoint table]

### Test Cases
#### [Endpoint Group]
[Test case table per endpoint]

### Contract Tests
[Schema validation rules]

### Authentication Test Matrix
[Auth scenario coverage]

### Environment & Data Setup
[Test data requirements and environment config]

### Execution
[How to run, CI integration, reporting]

Quality Checklist

  • Every endpoint has happy path and error path coverage
  • Authentication and authorization tested for all protected endpoints
  • Input validation covers type, length, format, and required/optional
  • Response schemas are validated against contract
  • Edge cases include empty results, max values, and special characters
  • Test data setup and cleanup are defined

Edge Cases

  • GraphQL APIs: Test query depth limits, field-level authorization, and N+1 detection
  • Webhook endpoints: Test signature validation, retry behavior, and idempotency
  • File upload endpoints: Test size limits, content-type validation, and malicious file handling
  • Streaming / SSE endpoints: Test connection lifecycle, reconnection, and backpressure
我的收藏