api-test
npx machina-cli add skill cyberwalk3r/qa-toolkit/api-test --openclawAPI Test Builder
Generate API tests from plain-English descriptions. Read qa-artifacts/.qa-config.json for project context.
Input
Accept via $ARGUMENTS: endpoint descriptions, API docs references, or workflow descriptions. Examples:
- "Test the user registration API"
- "Test the entire checkout workflow from cart to payment"
- "Verify the search endpoint handles special characters"
Workflow
- Understand the API — from description, OpenAPI spec (check
qa-artifacts/.qa-config.jsonfor existing specs), or code - Generate test cases covering:
- Success cases — valid request, expected response
- Validation — missing fields, invalid types, boundary values
- Authentication — with/without token, expired token, wrong role
- Error handling — 400, 401, 403, 404, 500 responses
- Edge cases — empty body, large payload, special characters, unicode
- Choose output format based on user preference:
- cURL commands (default) — copy-paste ready
- Postman collection — JSON importable
- Playwright API test — JavaScript, ready to run
- Chain multi-step workflows when needed
Output — cURL (Default)
# Test: Create user - success
curl -X POST http://localhost:3000/api/users \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-d '{"name": "Test User", "email": "test@example.com"}' \
-w "\nStatus: %{http_code}\n"
# Expected: 201 Created with user object
# Test: Create user - missing email
curl -X POST http://localhost:3000/api/users \
-H "Content-Type: application/json" \
-d '{"name": "Test User"}' \
-w "\nStatus: %{http_code}\n"
# Expected: 400 Bad Request with validation error
Multi-Step Workflow
For workflows, generate numbered steps with variable passing:
Step 1: Create user → capture userId
Step 2: Login as user → capture authToken
Step 3: Perform action using authToken
Step 4: Verify result
Step 5: Cleanup (delete user)
For detailed API test patterns, read references/api-patterns.md.
Save
Save to qa-artifacts/api-tests/api-test-YYYY-MM-DD-<endpoint>.md
Suggested Next Steps
After generating API tests, suggest:
- "Generate realistic test payloads with
/qa-toolkit:test-data."
Source
git clone https://github.com/cyberwalk3r/qa-toolkit/blob/main/skills/api-test/SKILL.mdView on GitHub Overview
Generates API test suites from natural-language descriptions and project context. Outputs are available as curl commands, Postman collections, or Playwright API tests, enabling quick test generation and multi-step workflows.
How This Skill Works
The tool analyzes the plain-English input, references OpenAPI specs or code as available, and generates test cases across success, validation, authentication, error handling, and edge cases. It then outputs in the chosen format (curl by default, or Postman/Playwright) and supports chaining multi-step workflows when needed.
When to Use It
- Test the user registration API
- Validate the entire checkout workflow from cart to payment
- Verify the search endpoint handles special characters
- Audit authentication flows with/without tokens and token expiry
- Test error handling across 400–500 responses and edge cases
Quick Start
- Step 1: Describe the API test in plain-English and reference OpenAPI if available
- Step 2: Choose output format (default curl) and run the generator
- Step 3: Save to qa-artifacts/api-tests/api-test-YYYY-MM-DD-<endpoint>.md
Best Practices
- Leverage qa-artifacts/.qa-config.json to align tests with the existing API specs
- Prioritize coverage of success, validation, auth, and error cases
- Parameterize test data and avoid hard-coding tokens
- Use reusable Postman / Playwright templates for maintainability
- Refer to api-patterns.md for detailed test patterns and structure
Example Use Cases
- Create user - success: POST /api/users returns 201 with user data
- Create user - validation: missing email yields 400
- Login flow: obtain a token and access a protected endpoint
- Checkout flow: cart -> payment with token authentication
- Search endpoint: handles Unicode and special characters