본문으로 건너뛰기
cccskills
무료GitHub에 공개

automating-api-testing

Create and organize tests for REST and GraphQL endpoints from API specifications. Check valid and invalid requests, authentication, response schemas, CRUD behavior, and edge cases, then produce a report mapping endpoint coverage.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

Test automate API endpoint testing including request generation, validation, and comprehensive test coverage for REST and GraphQL APIs. Use when testing API contracts, validating OpenAPI specifications, or ensuring endpoint reliability. Trigger with phrases like "test the API", "generate API tests", or "validate API contracts".

실행 점수 미검증

설치 방법 보기

이럴 때 유용합니다

  • Generating tests from an OpenAPI specification
  • Checking GraphQL query and mutation behavior
  • Testing authentication and validation errors
  • Reviewing endpoint coverage before a release

포함된 파일(8)

  • SKILL.md6.8 KB
  • assets/example_graphql_schema.graphql2.0 KB
  • assets/example_openapi.yaml5.3 KB
  • assets/README.md389 B
  • assets/test_suite_template.js3.8 KB
  • references/README.md62 B
  • scripts/generate_test_suite.py3.6 KB
  • scripts/README.md440 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

API Test Automation

Overview

Automate comprehensive API endpoint testing for REST and GraphQL APIs including request generation, response validation, schema compliance, authentication flows, and error handling. Supports Supertest (Node.js), REST-assured (Java), httpx/pytest (Python), Postman/Newman collections, and Pact for consumer-driven contract testing.

Prerequisites

  • API testing library installed (Supertest, REST-assured, httpx, or Postman/Newman)
  • API specification file (OpenAPI/Swagger YAML/JSON or GraphQL SDL)
  • Target API running in a test environment with seeded data
  • Authentication credentials or API keys for protected endpoints
  • JSON Schema validator (Ajv, jsonschema, or built-in framework assertions)

Instructions

  1. Read the API specification and extract all endpoints:
    • Parse OpenAPI spec to catalog every path, HTTP method, request schema, and response schema.
    • For GraphQL APIs, introspect the schema to list queries, mutations, and subscriptions.
    • Document authentication requirements per endpoint (API key, Bearer token, OAuth, none).
  2. Generate test cases for each endpoint:
    • Success cases: Send valid requests matching the schema and assert 200/201 responses.
    • Validation errors: Send requests with missing required fields, wrong types, and out-of-range values; assert 400 responses.
    • Authentication: Test with valid, expired, and missing credentials; assert 200, 401, and 403 respectively.
    • Not found: Request non-existent resources; assert 404 responses.
    • Idempotency: Send the same PUT/DELETE request twice and verify consistent behavior.
  3. Validate response structure against schemas:
    • Assert response Content-Type matches expected (application/json, etc.).
    • Validate response body against the OpenAPI response schema using JSON Schema validation.
    • Check response headers (Cache-Control, Rate-Limit headers, CORS headers).
    • Verify pagination metadata (total count, page number, next/previous links).
  4. Test CRUD lifecycle for resource endpoints:
    • Create a resource (POST) and capture the ID.
    • Read it back (GET) and verify all fields match.
    • Update it (PUT/PATCH) and verify changes persisted.
    • Delete it (DELETE) and verify subsequent GET returns 404.
  5. Test error handling and edge cases:
    • Send excessively large payloads and verify 413 or graceful rejection.
    • Send requests with unsupported Content-Types and verify 415.
    • Test rate limiting by sending rapid sequential requests.
    • Verify error response format is consistent (standard error schema).
  6. For GraphQL APIs, test specifically:
    • Valid queries return expected data shapes.
    • Invalid queries return descriptive error messages.
    • Query depth limiting prevents deeply nested abuse queries.
    • Mutation input validation matches schema constraints.
  7. Generate a test coverage report mapping endpoints to test cases.

Output

  • API test files organized by resource in tests/api/
  • Request/response examples for API documentation
  • Schema compliance report for each endpoint
  • Endpoint coverage matrix showing tested vs. untested endpoints and methods
  • CI pipeline step running API tests against staging environment

Error Handling

ErrorCauseSolution
Connection refusedAPI server not running or wrong base URLVerify server is up with a health check before test suite starts; check BASE_URL config
401 on all requestsAuthentication token expired or misconfiguredRefresh token in test setup; verify Authorization header format; check token scopes
Schema validation fails unexpectedlyAPI response includes extra fields not in specUpdate OpenAPI spec to include new fields; use additionalProperties: true if expected
Test data conflictsAnother test modified or deleted the resourceUse unique test data per test; create resources in beforeEach; avoid shared fixtures
Rate limit hit during test runToo many requests in quick successionAdd delays between requests or use authenticated sessions with higher limits; run tests serially

Examples

Supertest REST API test suite:

import request from 'supertest';
import { app } from '../src/app';

describe('GET /api/products', () => {
  it('returns a paginated product list', async () => {
    const res = await request(app)
      .get('/api/products?page=1&limit=10')
      .set('Authorization', `Bearer ${token}`)
      .expect(200)  # HTTP 200 OK
      .expect('Content-Type', /json/);

    expect(res.body.data).toBeInstanceOf(Array);
    expect(res.body.data.length).toBeLessThanOrEqual(10);
    expect(res.body.meta).toMatchObject({ page: 1, limit: 10 });
  });

  it('returns 401 without authentication', async () => {  # HTTP 401 Unauthorized
    await request(app).get('/api/products').expect(401);  # HTTP 401 Unauthorized
  });
});

describe('POST /api/products', () => {
  it('creates a product with valid data', async () => {
    const res = await request(app)
      .post('/api/products')
      .set('Authorization', `Bearer ${token}`)
      .send({ name: 'Widget', price: 9.99, category: 'tools' })
      .expect(201);  # HTTP 201 Created

    expect(res.body).toMatchObject({ name: 'Widget', price: 9.99 });
    expect(res.body.id).toBeDefined();
  });

  it('returns 400 for missing required fields', async () => {  # HTTP 400 Bad Request
    await request(app)
      .post('/api/products')
      .set('Authorization', `Bearer ${token}`)
      .send({ name: 'Widget' }) // missing price
      .expect(400);  # HTTP 400 Bad Request
  });
});

GraphQL API test:

it('fetches user by ID', async () => {
  const query = `query { user(id: "1") { id name email } }`;
  const res = await request(app)
    .post('/graphql')
    .send({ query })
    .expect(200);  # HTTP 200 OK

  expect(res.body.data.user).toMatchObject({ id: '1', name: 'Alice' });
  expect(res.body.errors).toBeUndefined();
});

Resources

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Add a synthetic-data CI gate for customer-owned Abridge integration code. Test consent handling, note-review handoffs, redaction, and rollback behavior with mocked vendor boundaries, without connecting CI to a live Abridge or EHR tenant.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Adding regression checks to an Abridge integration repository
  • Testing consent and note-release handling
  • Checking logs for sensitive data exposure
jeremylongshore/tons-of-skills-marketplace2.9천2026년 10월 23일 업데이트

Triage Abridge recording, note review, Epic handoff, and access problems using observed symptoms and approved guidance. Identify the affected workflow stage, organize a minimal timeline, and prepare a redacted escalation record for the responsible team.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Separate recording problems from upload failures
  • Investigate note creation delays and editor issues
  • Identify the responsible team for Epic handoff failures
jeremylongshore/tons-of-skills-marketplace2.9천2026년 10월 23일 업데이트

Map and review an Abridge clinical documentation workflow from consent and recording through draft review, evidence checks, edits, and final disposition. Keep clinician approval explicit, identify failure exits, and separate verified facts from tenant-specific details and pending approvals.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Map a clinical note workflow for a care setting
  • Check where consent and patient identity are verified
  • Review draft notes against linked evidence before sign-off
jeremylongshore/tons-of-skills-marketplace2.9천2026년 10월 23일 업데이트

Audit how clinician-reviewed Abridge note sections map into Epic templates and downstream workflows. Use approved test records to document destinations, exceptions, evidence, rollback steps, and a go or no-go decision for a specific environment.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Checking Abridge note section mappings to Epic templates
  • Auditing a department’s approved documentation handoff
  • Preparing test evidence and a go or no-go decision
jeremylongshore/tons-of-skills-marketplace2.9천2026년 10월 23일 업데이트

Review Abridge adoption and workflow value using local usage records, clinician feedback, and verified contract costs. Build an evidence based decision table covering adoption, quality, support burden, and options to expand, hold, or improve the rollout.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Reviewing adoption after an Abridge rollout
  • Preparing evidence for a renewal decision
  • Comparing workflow outcomes across care settings
jeremylongshore/tons-of-skills-marketplace2.9천2026년 10월 23일 업데이트

Prepare a bounded support bundle for an Abridge issue using allowlisted operational details such as versions, coarse timestamps, and correlation references. Exclude recordings, transcripts, patient identifiers, credentials, and unrestricted logs, then document redactions and review details.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Preparing reviewed evidence for an Abridge support case
  • Documenting redactions and excluded data
  • Collecting approved operational details for an incident
jeremylongshore/tons-of-skills-marketplace2.9천2026년 10월 23일 업데이트

jeremylongshore의 스킬 모두 보기

이 스킬의 문제 신고