| name | api-testing |
| description | Use this skill when writing, reviewing, or debugging API tests for REST or GraphQL endpoints. Covers request/response validation, status codes, authentication, error handling, schema checks, pagination, and rate limiting. Trigger when the user mentions API testing, REST, GraphQL, endpoint validation, or response schema checks. |
API Testing Skill
A reference for GitHub Copilot to generate high-quality API tests covering REST and GraphQL endpoints.
REST API Testing
When to use: Validating API endpoints, contracts, and error handling.
Prompting patterns:
Write API tests for [endpoint] covering:
- Success responses (status codes, response shape, data types)
- Authentication/authorization (valid, expired, missing tokens)
- Validation errors (missing required fields, invalid formats)
- Edge cases (empty arrays, large payloads, special characters)
- Rate limiting behavior
Best practices:
- Validate response schemas, not just status codes
- Test idempotency for PUT/DELETE operations
- Check error response format consistency across endpoints
- Use realistic test data, not placeholder values
GraphQL API Testing
Prompting patterns:
Write tests for this GraphQL query/mutation:
- Valid queries with expected response structure
- Partial data requests (field selection)
- Error handling for invalid queries
- Authorization checks on protected fields
General API Testing Tips
- Always test both success and failure paths
- Verify response headers (Content-Type, Cache-Control, CORS)
- Test pagination, sorting, and filtering parameters
- Validate error response format is consistent across all endpoints
- Check that sensitive data is not leaked in error responses