Community编程与开发github.com

qa-api-test

Design and run API tests like a QA engineer. Turns an API description (OpenAPI/Swagger file, curl command, Postman request, or plain-text docs) into a test case table covering positive, negative and boundary cases, generates a Postman v2.1 collection, runs it with Newman, and reports defects with expected vs actual results. Use when the user asks to "test this API", "bikin test case API", "negative test", "buat collection Postman", or wants to check an endpoint for validation, auth, or duplicate-request bugs.

qa-api-test 是什么?

qa-api-test is a Claude Code agent skill that design and run API tests like a QA engineer. Turns an API description (OpenAPI/Swagger file, curl command, Postman request, or plain-text docs) into a test case table covering positive, negative and boundary cases, generates a Postman v2.1 collection, runs it with Newman, and reports defects with expected vs actual results. Use when the user asks to "test this API", "bikin test case API", "negative test", "buat collection Postman", or wants to check an endpoint for validation, auth, or duplicate-request bugs.

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/andifajriimaf/qa-api-test-skill/tree/HEAD

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

QA API Test

Builds API tests the way a QA engineer would: design the cases first, get them approved, then automate and report. Works with any agent that reads SKILL.md.

Prerequisites

  • Python 3.9+ (standard library only)
  • Node.js 18+ for Newman: npm install -g newman newman-reporter-htmlextra (or npx newman ... without a global install)

Workflow (follow these steps in order)

  1. Understand the API. Read the spec, curl, or docs the user gives. List each endpoint with its method, auth, required fields, field types and limits. If something important is missing (base URL, auth method, which environment is safe to test), ask before going on. Never run tests against production unless the user says it is allowed.
  2. Design test cases. For each endpoint, write positive cases first, then walk through every category in templates/negative-checklist.md. Put them in a table using the format in templates/test-case-table.md (ID, category, endpoint, scenario, input, expected result, priority). Show the table and wait for the user to approve or edit it.
  3. Write the spec file. Convert the approved table into cases.json (format below). Each case has an expect block; add expectedText with the human-readable expectation used in the report.
  4. Generate the collection. python scripts/build_collection.py cases.json -o collection.json The output imports directly into Postman (File > Import).
  5. Run it.
    npx newman run collection.json -r cli,json,htmlextra \
      --reporter-json-export newman/report.json \
      --reporter-htmlextra-export newman/report.html
    
  6. Report. python scripts/summarize.py newman/report.json cases.json prints a Markdown table (test case, expected, actual, PASS/FAIL). For every FAIL, write a short defect: title, steps (request), expected, actual (status code and relevant body), and severity. A 5xx on bad input, accepted invalid data, and duplicate transactions are at least Major.
  7. Hand over. Give the user cases.json, collection.json, newman/report.html, and the defect list. Do not "fix" expectations to make tests pass; a failing test is a finding.

Spec format (cases.json)

{
  "name": "API Negative Tests - My Service",
  "baseUrl": "https://api.example.com",
  "headers": {"Content-Type": "application/json"},
  "cases": [
    {
      "id": "TC01", "name": "Missing required field (email)",
      "method": "POST", "path": "/users",
      "headers": {"Authorization": "Bearer {{token}}"},
      "body": {"name": "Andi"},
      "expectedText": "400 Bad Request",
      "expect": {"status": [400], "noServerError": true}
    }
  ]
}

expect keys:

KeyMeaning
statusList of allowed status codes
noServerErrorFails on any 5xx
bodyContains / bodyNotContainsText that must / must not appear in the response
maxResponseTimeMsUpper limit for response time
sameAsVar{"field", "var"}: response field must equal a saved variable, or the status is 409 (duplicate checks)

Other case keys: save ({"varName": "responseField"} stores a value for later cases) and setup: true (a helper request that is left out of the summary table).

Example

examples/restful-booker/ runs 5 negative cases against Restful Booker, a public API made for testing practice. Result: 1 pass and 4 defects (500 on a missing field, invalid and negative prices accepted, duplicate booking created). See its README.md.

相关技能