- Home
- Skills
- Testing & Debugging
- OpenAPI-to-Mock Test Harness Builder
More screenshots
Works with the AI tools you already use
OpenAPI-to-Mock Test Harness Builder
Turn an OpenAPI spec into an executable local mock server, deterministic fixtures, constraint-derived negative tests, and an endpoint coverage report.
$5
OpenAPI-to-Mock Test Harness Builder
Example session with this skill installed
Build a local mock and contract-test harness from:
openapi.yaml
Requirements
- parse the full OpenAPI document;
- inventory every documented operation;
- resolve local $ref references;
- prefer explicit examples already present in the spec;
- generate deterministic valid request and response fixtures when examples are missing;
- generate negative cases from required fields, enums, primitive types, string constraints, numeric bounds, array constraints, and required parameters;
- generate a local mock server for all documented routes;
- include representative documented 4xx/5xx responses when available;
- generate positive contract tests;
- generate concrete negative tests where the schema provides enough information;
- flag unresolved external references instead of inventing schemas;
- do not call production APIs;
- do not embed real credentials;
- generate an endpoint coverage report;
- run validation and tests when the local dependencies are available.
Use the repository's existing API-test/mock stack if one is already configured. Otherwise, generate the default Python/FastAPI/pytest harness.
- Read your context and instructions
- Compiled the openapi-to-mock test harness
OpenAPI mock/test harness complete
OpenAPI version
3.1.0
API
Commerce API
Operations discovered
42
Success fixtures generated
42
Request fixtures generated
27
Documented error fixtures generated
18
Constraint-derived negative cases
96
Mock routes generated
42
Positive contract tests
42
Concrete negative tests
71
Manual-review negative cases
25
Unresolved references
0
Coverage summary
Operations with success fixtures
42 / 42
Operations with positive tests
42 / 42
Operations with at least one negative case:
34 / 42
Operations with documented error fixtures
18 / 42
Operations requiring manual review
5
Harness coverage
100% route generation
81% operations with negative coverage
This is harness coverage, not production code coverage.
Example endpoint
POST /customers
Generated valid request
{
"name": "Example Customer",
"email": "user@example.test",
"plan": "pro"
}
Generated success fixture
{
"id": "00000000-0000-4000-8000-000000000001",
"name": "Example Customer",
"email": "user@example.test",
"plan": "pro"
}
Constraint-derived tests
email:
- required field missing
- wrong primitive type
- invalid email format
plan:
- enum violation
name:
- below minLength
- above maxLength
Generated local server
Run
python -m pip install -r requirements.generated.txt
uvicorn mock_server.app:app --reload --port 4010
Mock URL
Example generated test
def test_create_customer_happy_path():
response = client.post(
"/customers",
json={
"name": "Example Customer",
"email": "user@example.test",
"plan": "pro"
},
)
assert response.status_code == 201
Example negative test
def test_create_customer_missing_email():
payload = {
"name": "Example Customer",
"plan": "pro"
}
response = client.post("/customers", json=payload)
assert response.status_code in {400, 422}
Files generated
- api_inventory.json
- fixtures/
- negative_cases.json
- mock_server/app.py
- tests/test_contracts.py
- requirements.generated.txt
- coverage_report.json
- validation_report.md
- README.generated.md
Validation
Fixture JSON parsing: PASS
Local reference resolution: PASS
Mock server import: PASS
Contract tests: PASS
This harness validates the generated mock contract against the OpenAPI document. It does not prove that the production backend implements the same behavior unless the same contract tests are also run against that backend.
Connects securely to your tools. The creator never sees your data.
About this skill
Manual API testing and mock creation waste hours of developer time, especially when the spec changes. This skill automates the generation of an executable test harness directly from your OpenAPI 3.x definitions. It produces more than just documentation, it builds a functional sandbox for frontend development and a rigorous contract testing suite for the backend.
What it does
- Parse specifications Validates and inventories all paths, operations, and schemas from your OpenAPI YAML or JSON files.
- Generate fixtures Derives deterministic valid data from examples, enums, and schema constraints to use in tests.
- Derive negative cases Automatically identifies boundary violations like missing required fields, type mismatches, and range errors.
- Build mock servers Scaffolds a Python FastAPI and Uvicorn server that serves your fixtures locally.
- Create contract tests Generates a pytest suite to verify that your implementation matches the documented request and response shapes.
- Report coverage Produces a detailed inventory of operations, fixtures, and test coverage to identify gaps in your API design.
How it works
- Inventory The agent scans your
openapi.yamlto map all endpoints, parameters, and response codes. - Fixture derivation It extracts values from
exampletags or generates them based onminLength,maximum, and other constraints. - Harness generation The agent writes the FastAPI mock server, the pytest files, and the
api_inventory.json. - Validation It validates the generated JSON against the original schemas to ensure the harness itself is compliant.
Frameworks & tools
Built for Python environments using FastAPI, Uvicorn, pytest, httpx, and jsonschema. It supports OpenAPI 3.x specifications in both YAML and JSON formats.
Why this beats prompting it yourself
Generic prompts often produce hallucinated examples or ignore schema constraints like multipleOf or pattern. This skill follows a strict resolution priority and deterministic generation logic to ensure your mocks and tests actually match the contract every time.
Use cases
- Accelerate frontend development by providing a local mock server before the backend exists.
- Detect breaking changes in API updates by running generated contract tests against the new spec.
- Generate exhaustive negative test cases to improve backend input validation.
- Audit existing OpenAPI files for missing examples or incomplete schema definitions.
Known limitations
Does not support external $ref links that require remote authentication. Requires a Python environment with PyYAML for YAML processing. Does not verify production business logic beyond the schema.
How to use
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 9 days ago
- Passed all security checks, Safe to install
Needs access to