api-integration-test-generator

Generates pytest integration tests for FastAPI endpoints from API specification documents.

Updated Aug 15, 2026
One-click install
npx skills add https://github.com/jacksonlee-tw/mystock-vue --skill api-integration-test-generator-jacksonlee-tw
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-integration-test-generator
Source: https://github.com/jacksonlee-tw/mystock-vue/tree/main/mystock-analysis/.github/skills/api-integration-test-generator
Command: npx skills add https://github.com/jacksonlee-tw/mystock-vue --skill api-integration-test-generator-jacksonlee-tw

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing comprehensive integration tests for every FastAPI endpoint is repetitive and error-prone. This Skill automates the creation of pytest test suites from API specification documents, ensuring consistent coverage of happy paths, error codes, validation failures, and edge cases without manual boilerplate. ## Core Features & Use Cases - Standard Test Matrix: Automatically generates tests for each endpoint covering success cases, 404 not found, 422 validation errors, 409 conflicts, 401/403 auth checks, boundary conditions, pagination, sorting, and filtering. - Test Infrastructure Generation: Produces conftest.py with async database fixtures and HTTP test clients, plus test data factories for valid and invalid request payloads. - Structured Output: Creates organized test classes per HTTP method (POST, GET, PUT, DELETE) following FastAPI testing conventions, with a summary report of coverage. - Use Case: After generating a FastAPI router from an API spec, invoke this Skill to produce a complete test suite with 12+ test cases per module, ready to run with pytest. ## Quick Start Generate pytest integration tests for the weighing module based on its API specification document.

Frequently Asked Questions about api-integration-test-generator

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

FAQPage Schema
How do I generate pytest integration tests from an API specification?▼

Provide the API specification document, router code, and Pydantic schema definitions. The Skill generates conftest.py with database fixtures, test data factories, and test classes covering success cases, 404 errors, 422 validation failures, and pagination for each endpoint.

What test cases are generated for each FastAPI endpoint?▼

Each endpoint gets a standard matrix: happy path success tests, 404 not found for GET/PUT/DELETE, 422 validation errors for POST/PUT, 409 conflicts for unique constraints, 401/403 auth checks when required, plus pagination, sorting, and filtering tests for list endpoints.

Does this work with async FastAPI applications and SQLAlchemy?▼

Yes, the generated conftest.py uses pytest-asyncio with httpx AsyncClient and ASGITransport. It creates an async SQLAlchemy engine with aiosqlite for test databases, overriding the get_db dependency to isolate each test with fresh tables.

How are test data factories structured for invalid input scenarios?▼

Factories provide make_<resource>_data() for valid payloads with sensible defaults from schema definitions, and make_<resource>_invalid_data(scenario) supporting scenarios like missing_required, invalid_type, and exceed_max_length for negative testing.

Can I generate only service layer unit tests without router tests?▼

Service layer tests (test_<module>_service.py) are marked as optional output. The primary focus is router integration tests, but you can request service unit tests as an additional artifact when needed.