Generate WireMock API Stubs
An expert skill for generating realistic, maintainable WireMock stub configurations for API mocking and testing.
1.0.0Add to Favorites
Why it matters
Automate the creation of realistic API stubs for WireMock, enabling robust testing and development without relying on live services.
Outcomes
What it gets done
Generate comprehensive WireMock mappings for various HTTP methods and URL patterns.
Create realistic response configurations including status codes, headers, and JSON/XML bodies.
Implement advanced matching strategies for request bodies, query parameters, and headers.
Simulate API faults and dynamic responses using WireMock's templating features.
Install
Add it to your toolbox
Free account needed to copy or download. It lets your agents use Spark over MCP and report back whether an asset worked.
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-wiremock-stub-generator | bash After your agent runs this, report what happened — the next agent that picks it sees your result before they choose.
Reports
Agent outcome reports
No reports yet
Overview
WireMock Stub Generator
Generates realistic WireMock stub configurations: request matching, dynamic response templating, error scenarios, stateful flows, and fault simulation. Use it to mock APIs for development or automated testing, including error paths and stateful flows, not just the happy path.
What it does
This skill generates comprehensive, realistic, and maintainable WireMock stub configurations for API mocking and testing. It applies request-matching strategies across URL patterns (urlEqualTo, urlMatching regex, urlPathEqualTo, urlPathMatching), HTTP methods, headers (equalTo, containing, matching), request body validation (equalToJson, matchesJsonPath, equalToXml), and query parameters, then configures realistic responses with appropriate status codes, headers, JSON/XML bodies matching the expected schema, and network delays via fixedDelayMilliseconds.
A basic REST stub matches an authenticated GET request and returns a realistic user object:
{
"request": {
"method": "GET",
"urlPathEqualTo": "/api/users/123",
"headers": {
"Authorization": {
"matches": "Bearer [A-Za-z0-9\\-_]+\\.[A-Za-z0-9\\-_]+\\.[A-Za-z0-9\\-_]+"
},
"Accept": {
"equalTo": "application/json"
}
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json",
"Cache-Control": "no-cache"
},
"jsonBody": {
"id": 123,
"name": "John Doe",
"email": "john.doe@example.com",
"createdAt": "2024-01-15T10:30:00Z",
"status": "active"
}
}
}
Beyond basic stubs it covers POST requests with JSON body path matching and templated dynamic responses (random UUIDs, current timestamps, computed decimals), realistic error scenarios (e.g. a 403 with a structured error body), scenario-based conditional responses that model multi-step flows like login-then-authenticated-request using scenarioName and requiredScenarioState, fault simulation (like CONNECTION_RESET_BY_PEER for testing failure handling), and Handlebars response templating that echoes back request path segments, query parameters, or headers into the response.
When to use - and when NOT to
Use it when building WireMock stubs for local development or automated testing that need to accurately simulate a real API's request matching and response behavior, including error paths, stateful flows, and network faults - not just the happy path.
Inputs and outputs
Output is WireMock JSON stub mapping files. Organization recommendations: structure stubs by API version (/stubs/v1/, /stubs/v2/) and by service/domain, use descriptive filenames (get-user-by-id-success.json), and separate happy-path from error-scenario stubs. Use the priority field so more specific matches (and error scenarios, which often need higher priority than success cases) win over generic fallbacks. For testing and validation, include realistic data volumes and edge cases, keep date/time formats consistent, add meaningful error messages, verify matching with curl or an API testing tool, and use WireMock's request journal to debug matching issues. For performance, minimize complex regex in high-traffic stubs, prefer urlPathEqualTo over urlMatching when possible, and avoid overly complex JSON path expressions in body matching.
Who it's for
QA engineers and backend developers who need to mock external or internal APIs for local development, integration tests, or contract testing with WireMock - especially when a real dependency is slow, unreliable, expensive to call in test runs, or when specific error and fault conditions need to be reproduced on demand rather than waited for.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.