api-testing

Automate API testing for endpoints, middleware, and integrations with Vitest.

21|2|Updated Nov 5, 2023
One-click install
npx skills add https://github.com/motormetrics/motormetrics --skill api-testing-motormetrics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-testing
Source: https://github.com/motormetrics/motormetrics/tree/main/.claude/skills/api-testing
Command: npx skills add https://github.com/motormetrics/motormetrics --skill api-testing-motormetrics

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

API testing automates the validation of endpoints, middleware, and integrations to prevent regressions and ensure reliability across services.

Core Features & Use Cases

  • Vitest-based tests: write unit and integration tests for API routes, middleware, and utilities.
  • Comprehensive validation: verify request/response shapes, status codes, and error handling.
  • Use Case: when introducing a new API, create tests to cover health checks, parameter validation, and error responses.

Quick Start

Run the Vitest test suite to validate API endpoints and middleware across your app.

Frequently Asked Questions about api-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test API endpoints and prevent regressions in my web services?

API testing automates endpoint and middleware validation to prevent regressions. Using Vitest, you write unit and integration tests under apps/web/__tests__ to verify request/response shapes, status codes, and error handling.

How do I validate API request and response shapes using Vitest?

You validate API request and response shapes in Vitest by writing integration tests that assert expected status codes and payload structures. This Skill organizes tests under apps/web/__tests__ with reusable helpers and mock utilities for comprehensive validation.

Does this API testing approach work for testing middleware and error handling?

Yes, API testing with Vitest supports testing middleware and error handling. It automates comprehensive validation for integrations, allowing you to verify health checks, parameter validation, and error responses across your web services.

What is the best way to structure API tests for new web service routes?

The best way to structure API tests is organizing them under apps/web/__tests__ with reusable helpers and mock utilities. This Vitest-based structure covers health checks, parameter validation, and error responses for new API routes.

Why do I need mock utilities for API endpoint testing?

Mock utilities are needed for API endpoint testing to isolate routes and middleware during validation. They allow you to simulate request/response scenarios and verify error handling without relying on live external integrations.

Can I use Vitest for both unit and integration testing of API functionality?

Yes, you can use Vitest for both unit and integration testing of API functionality. It serves as the test runner for validating API routes, middleware, and utilities to ensure reliability across services.