Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
oakoss avatar

Api Testing

  • 90 installs
  • 14 repo stars
  • Updated March 2, 2026
  • oakoss/agent-skills

Helps with testing & qa tasks during AI-assisted development.

About

api-testing is a Claude Code skill for testing & qa. It helps solo builders move faster with AI-assisted coding.

  • api-testing
  • Testing & QA
  • AI-coding skill

Api Testing by the numbers

  • 90 all-time installs (skills.sh)
  • +3 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #1,041 of 2,153 Testing & QA skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oakoss/agent-skills --skill api-testing

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs90
repo stars14
Last updatedMarch 2, 2026
Repositoryoakoss/agent-skills

What it does

Helps with testing & qa tasks during AI-assisted development.

Files

SKILL.mdMarkdownGitHub ↗

API Testing

Overview

API testing validates HTTP endpoints by sending requests and asserting responses, covering status codes, headers, body content, and error handling. Supertest provides a fluent chainable API for integration testing against Express, Fastify, and Hono apps without starting a real server. MSW (Mock Service Worker) v2 intercepts outgoing HTTP requests at the network level, enabling realistic mocking of external services in both Node.js tests and browser environments.

When to use: Integration tests for REST APIs, testing middleware pipelines, validating request/response contracts, mocking third-party APIs in tests, testing error handling and edge cases.

When NOT to use: Unit testing pure functions (use direct assertions), E2E browser testing (use Playwright/Cypress), load/performance testing (use k6/Artillery), testing static file serving.

Quick Reference

PatternAPIKey Points
GET requestrequest(app).get('/path')Returns supertest Test object
POST with bodyrequest(app).post('/path').send(body)Automatically sets Content-Type
Auth header.set('Authorization', 'Bearer token')Chain before .expect()
Status assertion.expect(200)Chainable with body assertions
Body assertion.expect({ key: 'value' })Deep equality check
Header assertion.expect('Content-Type', /json/)Accepts string or regex
MSW HTTP handlerhttp.get('/api/users', resolver)Intercepts matching requests
MSW GraphQL handlergraphql.query('GetUser', resolver)Intercepts by operation name
MSW responseHttpResponse.json(data, { status })v2 response format
MSW error simulationHttpResponse.error()Simulates network failure
MSW one-time handlerhttp.get(path, resolver, { once: true })Auto-removed after first match
MSW per-test overrideserver.use(handler)Override default handlers in specific tests
Schema validationschema.parse(response.body)Validates response structure with Zod
Cookie persistenceconst agent = request.agent(app)Maintains cookies across requests
Fastify injectapp.inject({ method, url })Built-in testing without supertest
Hono test clienttestClient(app)Type-safe request builder

Common Mistakes

MistakeCorrect Pattern
Not awaiting supertest requestsAlways await request(app).get('/path')
Sharing server state between testsReset handlers with server.resetHandlers() in afterEach
Mocking fetch/axios directlyUse MSW to intercept at the network level
Forgetting server.listen() in setupCall in beforeAll, resetHandlers in afterEach
Passing Fastify instance to supertestUse fastify.server (the underlying Node server)
Asserting before response completesUse await or return the supertest chain
Hardcoding test data across many testsUse factories or fixtures for test data
Not testing error responsesTest 4xx and 5xx paths alongside happy paths
Using server.close() in afterEachUse afterAll for close, afterEach for reset only
Ignoring response headers in assertionsValidate Content-Type, Cache-Control, CORS headers
Not using onUnhandledRequest: 'error'Catch unhandled requests to prevent silent test gaps
Testing implementation instead of behaviorAssert on response shape, not internal function calls

Delegation

  • Test structure review: Use Task agent
  • Code review: Delegate to code-reviewer agent
  • Pattern discovery: Use Explore agent
If the vitest-testing skill is available, delegate general Vitest configuration and patterns to it.
Otherwise, recommend: npx skills add oakoss/agent-skills --skill vitest-testing

References

  • Supertest integration testing patterns for Express, Fastify, and Hono
  • MSW request handlers, response resolvers, and server setup
  • Test organization, fixtures, factories, and setup/teardown
  • Response assertions, status codes, headers, and schema validation

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.