Api Test Automation
This skill provides automated assistance for api test automation tasks.
Prerequisites
Before using this skill, ensure you have:
- API definition files (OpenAPI/Swagger, GraphQL schema, or endpoint documentation)
- Base URL for the API service (development, staging, or test environment)
- Authentication credentials or API keys if endpoints require authorization
- Testing framework installed (Jest, Mocha, Supertest, or equivalent)
- Network connectivity to the target API service
Instructions
Step 1: Analyze API Definition
Examine the API structure and endpoints:
- Use Read tool to load OpenAPI/Swagger specifications from {baseDir}/api-specs/
- Identify all available endpoints, HTTP methods, and request/response schemas
- Document authentication requirements and rate limiting constraints
- Note any deprecated endpoints or breaking changes
Step 2: Generate Test Cases
Create comprehensive test coverage:
- Generate CRUD operation tests (Create, Read, Update, Delete)
- Add authentication flow tests (login, token refresh, logout)
- Include edge case tests (invalid inputs, boundary conditions, malformed requests)
- Create contract validation tests against OpenAPI schemas
- Add performance tests for critical endpoints
Step 3: Execute Test Suite
Run automated API tests:
- Use Bash(test:api-*) to execute test framework with generated test files
- Validate HTTP status codes match expected responses (200, 201, 400, 401, 404, 500)
- Verify response headers (Content-Type, Cache-Control, CORS headers)
- Validate response body structure against schemas using JSON Schema validation
- Test authentication token expiration and renewal flows
Step 4: Generate Test Report
Document results in {baseDir}/test-reports/api/:
- Test execution summary with pass/fail counts
- Coverage metrics by endpoint and HTTP method
- Failed test details with request/response payloads
- Performance benchmarks (response times, throughput)
- Contract violation details if schema mismatches detected
Output
The skill generates structured API test artifacts:
Test Suite Files
Generated test files organized by resource:
{baseDir}/tests/api/users.test.js - User endpoint tests
{baseDir}/tests/api/products.test.js - Product endpoint tests
{baseDir}/tests/api/auth.test.js - Authentication flow tests
Test Coverage Report
- Endpoint coverage percentage (target: 100% for critical paths)
- HTTP method coverage per endpoint (GET, POST, PUT, PATCH, DELETE)
- Authentication scenario coverage (authenticated vs. unauthenticated)
- Error condition coverage (4xx and 5xx responses)
Contract Validation Results
- OpenAPI schema compliance status for each endpoint
- Breaking changes detected between specification versions
- Undocumented endpoints or parameters found in implementation
- Response schema violations with diff details
Performance Metrics
- Average response time per endpoint
- 95th and 99th percentile latencies
- Requests per second throughput measurements
- Timeout occurrences and slow endpoint identification
Error Handling
Common issues and solutions:
Connection Refused
- Error: Cannot connect to API service at specified base URL
- Solution: Verify service is running using Bash(test:api-healthcheck); check network connectivity and firewall rules
Authentication Failures
- Error: 401 Unauthorized or 403 Forbidden on protected endpoints
- Solution: Verify API keys are valid and not expired; ensure bearer token format is correct; check scope permissions
Schema Validation Errors
- Error: Response does not match OpenAPI schema definition
- Solution: Update OpenAPI specification to match actual API behavior; file bug if API implementation is incorrect
Timeout Errors
- Error: Request exceeded configured timeout threshold
- Solution: Increase timeout for slow endpoints; investigate performance issues on API server; add retry logic for transient failures
Resources
API Testing Frameworks
- Supertest for Node.js HTTP assertion testing
- REST-assured for Java API testing
- Postman/Newman for collection-based API testing
- Pact for contract testing and consumer-driven contracts
Validation Libraries
- Ajv for JSON Schema validation
- OpenAPI Schema Validator for spec compliance
- Joi for Node.js schema validation
- GraphQL Schema validation tools
Best Practices
- Test against non-production environments to avoid data corruption
- Use test data factories to create consistent test fixtures
- Implement proper test isolation with database cleanup between tests
- Version control test suites alongside API specifications
- Run tests in CI/CD pipeline for continuous validation
Overview
This skill provides automated assistance for api test automation tasks.
This skill provides automated assistance for the described functionality.
Examples
Example usage patterns will be demonstrated in context.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: helixdevelopment-helixagent-automating-api-testing3description: Api Test Automation4---5# Api Test Automation67This skill provides automated assistance for api test automation tasks.89## Prerequisites1011Before using this skill, ensure you have:12- API definition files (OpenAPI/Swagger, GraphQL schema, or endpoint documentation)13- Base URL for the API service (development, staging, or test environment)14- Authentication credentials or API keys if endpoints require authorization15- Testing framework installed (Jest, Mocha, Supertest, or equivalent)16- Network connectivity to the target API service1718## Instructions1920### Step 1: Analyze API Definition21Examine the API structure and endpoints:221. Use Read tool to load OpenAPI/Swagger specifications from {baseDir}/api-specs/232. Identify all available endpoints, HTTP methods, and request/response schemas243. Document authentication requirements and rate limiting constraints254. Note any deprecated endpoints or breaking changes2627### Step 2: Generate Test Cases28Create comprehensive test coverage:291. Generate CRUD operation tests (Create, Read, Update, Delete)302. Add authentication flow tests (login, token refresh, logout)313. Include edge case tests (invalid inputs, boundary conditions, malformed requests)324. Create contract validation tests against OpenAPI schemas335. Add performance tests for critical endpoints3435### Step 3: Execute Test Suite36Run automated API tests:371. Use Bash(test:api-*) to execute test framework with generated test files382. Validate HTTP status codes match expected responses (200, 201, 400, 401, 404, 500)393. Verify response headers (Content-Type, Cache-Control, CORS headers)404. Validate response body structure against schemas using JSON Schema validation415. Test authentication token expiration and renewal flows4243### Step 4: Generate Test Report44Document results in {baseDir}/test-reports/api/:45- Test execution summary with pass/fail counts46- Coverage metrics by endpoint and HTTP method47- Failed test details with request/response payloads48- Performance benchmarks (response times, throughput)49- Contract violation details if schema mismatches detected5051## Output5253The skill generates structured API test artifacts:5455### Test Suite Files56Generated test files organized by resource:57- `{baseDir}/tests/api/users.test.js` - User endpoint tests58- `{baseDir}/tests/api/products.test.js` - Product endpoint tests59- `{baseDir}/tests/api/auth.test.js` - Authentication flow tests6061### Test Coverage Report62- Endpoint coverage percentage (target: 100% for critical paths)63- HTTP method coverage per endpoint (GET, POST, PUT, PATCH, DELETE)64- Authentication scenario coverage (authenticated vs. unauthenticated)65- Error condition coverage (4xx and 5xx responses)6667### Contract Validation Results68- OpenAPI schema compliance status for each endpoint69- Breaking changes detected between specification versions70- Undocumented endpoints or parameters found in implementation71- Response schema violations with diff details7273### Performance Metrics74- Average response time per endpoint75- 95th and 99th percentile latencies76- Requests per second throughput measurements77- Timeout occurrences and slow endpoint identification7879## Error Handling8081Common issues and solutions:8283**Connection Refused**84- Error: Cannot connect to API service at specified base URL85- Solution: Verify service is running using Bash(test:api-healthcheck); check network connectivity and firewall rules8687**Authentication Failures**88- Error: 401 Unauthorized or 403 Forbidden on protected endpoints89- Solution: Verify API keys are valid and not expired; ensure bearer token format is correct; check scope permissions9091**Schema Validation Errors**92- Error: Response does not match OpenAPI schema definition93- Solution: Update OpenAPI specification to match actual API behavior; file bug if API implementation is incorrect9495**Timeout Errors**96- Error: Request exceeded configured timeout threshold97- Solution: Increase timeout for slow endpoints; investigate performance issues on API server; add retry logic for transient failures9899## Resources100101### API Testing Frameworks102- Supertest for Node.js HTTP assertion testing103- REST-assured for Java API testing104- Postman/Newman for collection-based API testing105- Pact for contract testing and consumer-driven contracts106107### Validation Libraries108- Ajv for JSON Schema validation109- OpenAPI Schema Validator for spec compliance110- Joi for Node.js schema validation111- GraphQL Schema validation tools112113### Best Practices114- Test against non-production environments to avoid data corruption115- Use test data factories to create consistent test fixtures116- Implement proper test isolation with database cleanup between tests117- Version control test suites alongside API specifications118- Run tests in CI/CD pipeline for continuous validation119120## Overview121122123This skill provides automated assistance for api test automation tasks.124This skill provides automated assistance for the described functionality.125126## Examples127128Example usage patterns will be demonstrated in context.129130---131> Converted and distributed by [TomeVault](https://tomevault.io/claim/helixdevelopment) — claim your Tome and manage your conversions.132<!-- tomevault:4.0:skill_md:2026-04-14 -->