Generate API Test Scenarios from an OpenAPI Spec
Generate a structured set of API test scenarios from an OpenAPI specification — covering positive, negative, schema validation, auth, pagination, and edge cases in a reviewable table format.
You are a senior QA engineer specialising in API testing. Generate a comprehensive set of API test scenarios from the OpenAPI specification or description provided below. API name and version: {{API_NAME}} OpenAPI spec or endpoint description: {{OPENAPI_SPEC}} Authentication mechanism: {{AUTH_MECHANISM}} Authorisation rules (who can access what): {{AUTHZ_RULES}} Known business rules or constraints: {{BUSINESS_RULES}} Generate a test scenario table with the following columns: Scenario ID | HTTP Method | Path | Scenario description | Input conditions | Expected status code | Expected response behaviour | Category Cover ALL of the following scenario categories for each endpoint provided: **Positive (happy path)** - Valid request with all required fields - Valid request with optional fields included - Valid request with optional fields omitted **Negative — input validation** - Missing required field(s) - Invalid data type (e.g. string where integer expected) - Value outside allowed range or enum - Request body that is empty or malformed JSON - Oversized payload (if applicable) **Authentication and authorisation** - Missing authentication token - Expired or invalid token - Valid token but insufficient permissions (if {{AUTHZ_RULES}} are defined) **Schema validation** - Response body matches documented schema for each status code - Required response fields are present **Pagination, filtering, and sorting** (where applicable) - Valid pagination parameters - Page beyond total count - Invalid sort field or direction **Idempotency and concurrency** (for mutating endpoints) - Duplicate submission of the same request (idempotency check) **Rate limiting** (if documented) - Request count at, below, and above the rate limit threshold Format the table in Markdown. After the table, list any scenarios you could not generate due to missing information and what additional spec detail would be needed. Important: Do not include real credentials, API keys, customer identifiers, or production data in any example values — use synthetic placeholders only.
{{API_NAME}}requiredName and version of the API
e.g. Orders API v2
{{OPENAPI_SPEC}}requiredOpenAPI spec excerpt or endpoint description — remove any real credentials or customer data before pasting
e.g. POST /orders — creates a new order. Request: {productId: string, quantity: integer (min 1), shippingAddressId: string}. Response 201: {orderId: UUID, status: 'pending'}. 400 on validation error. 401 if unauthenticated.
{{AUTH_MECHANISM}}requiredHow the API authenticates callers
e.g. Bearer JWT in Authorization header
{{AUTHZ_RULES}}Who can access which endpoints or data
e.g. Admin role can read all orders; standard user can only read their own orders
{{BUSINESS_RULES}}Domain-specific constraints that affect test design
e.g. Quantity must not exceed available stock; free shipping on orders over $50
- Verify every scenario maps to a real endpoint and HTTP method in the actual spec — the AI may infer endpoints not documented.
- Check that all expected status codes match your API's documented contract, not generic HTTP conventions.
- Confirm authorisation scenarios cover all role combinations relevant to your system.
- Validate that example values are synthetic — no real product IDs, customer references, or system identifiers.
- Add domain-specific edge cases the AI could not infer from the spec (e.g., business calendar, regional rules).
AI output requires human review before use. These checks are your responsibility.
- The AI infers test scenarios from the spec description — incomplete specs produce incomplete scenario coverage.
- Status codes and response shapes may be inferred rather than documented — verify against the actual API contract.
- Authorisation scenarios require knowing all role combinations — the AI can only cover the roles explicitly described.
- Scenarios for third-party integrations (payment gateways, shipping APIs) require knowledge the AI does not have.