Guides · task requirements

Choose a mock for an order cancellation

An order screen can show a pending order from one saved response. To test cancellation, the next read has to remember what changed. Choose a mock that can prove the behavior you need.

Run the assertion against a mock

Start with one pending order. Try the same task with different mock boundaries, then add a read that the scripted queue does not expect.

Serve the same pending body on every read, with a separate successful cancel response.

Order DeskNS
North StudioOrdersAccount
Your orders Order 104

Order details

Order ord_104

Ready to load
LIGHTINGArc desk lampWarm white Qty 1$48.00
Preparing your order

Order information appears when the client loads it.

Shipping
Free
Order total
$48.00

Client check

orders.test.ts
feature/order-cancellationOrder lifecycle / Cancel, then reopen
Expected final stateexpect(order.status).toBe("cancelled")

    The request sequence and assertion appear here after the check.

    What does the work need from the API?

    A reviewed captured or imported response can give you a known starting point. Related records help represent a customer situation. Explicit state rules matter when one action must affect the next request.

    A known response

    Develop the pending-order screen with a reviewed response. A fixed fixture may be enough.

    Related records

    Prepare a coherent customer situation when several screens or tools need to agree on the same order.

    Changing behavior

    Model the action when cancelling an order must change what a later read returns.

    Illustrative order cases. These are different input choices, not a required sequence.

    These approaches can overlap. Keep only the detail the application needs, then define a result that would reveal a wrong setup. Recording a response does not infer the upstream’s lifecycle rules.

    Make the assertion choose the boundary

    Write one expected action or visible result, then a second input that must produce a different outcome. A function fixture may answer the question. Add a wrapper, HTTP delivery or mutable state when that behavior belongs in the assertion.

    Check deployment and data requirements before investing in a scenario. The Security continuation below covers selected inputs, retained copies and configured connections.

    Four worked decision plans

    Choose what could prove this one result

    These plans name an adequate starting point and a check that could reject it. Record observed pass, fail or inconclusive evidence before accepting a candidate.

    Show one known order correctly

    The client parses a reviewed order response and displays the expected order state.

    Ordinary adequate route
    A local response fixture is adequate for a formatter or view test. Keep the existing test runner.
    The check that can reject it
    Pair the intended order with a wrong ID or another meaningful input. Reject a setup that returns or accepts the same successful case for both.
    Add a boundary
    Add HTTP when routing, request selection, response parsing or SDK behavior is part of the assertion.
    Conditional shortlist
    For HTTP, shortlist a WireMock Java/OSS fixed mapping, an intentionally selected Postman saved example, or an imported response in a Gostly service library.
    Evidence
    Plan: use the shared fixed-response comparison and consumer regression packet; record the actual request, parsed fields and client result.
    Operating effort
    The test owner maintains the fixture and assertions; an HTTP choice also needs matching, service routing and deployment ownership.
    Planned decision
    Keep the local fixture if it proves the assertion. Test an HTTP candidate only for the additional boundary you need.

    Official documentation: WireMock mappings · Postman examples · Saved-example matching · Saved-example configuration

    Cancel an order, then read the changed state

    Create, read, cancel and read again using the actual returned resource ID.

    Ordinary adequate route
    A response queue or authored state fixture can cover a fixed trace. Reset its cursor and client state between runs.
    The check that can reject it
    The first read is pending; the later read is cancelled for the same ID. Under the authored policy, repeated cancel is refused. Cancel A while B stays pending, then reset and reject stale-ID or leaked-state success.
    Add a boundary
    Use an HTTP state model when the clients or routing under test need it; define resource identity, isolation and reset explicitly.
    Conditional shortlist
    WireMock scenarios offer explicit states and reset for an authored finite trace. A configured Gostly resource/statechart is another candidate, with client reset owned separately.
    Evidence
    Plan: adapt the stateful guide’s negative control. Independent successful responses must fail the later-read assertion; record response origin where the model requires it.
    Operating effort
    The scenario owner maintains transitions, invalid actions, fixture IDs, reset and parallel-test isolation.
    Planned decision
    Keep a queue for the fixed trace if adequate. Switch to an explicit state model when alternate actions or independent resources are required.

    Official documentation: WireMock scenario states and reset

    Keep the response that exposed a client bug

    The same safe failure case rejects the old client and accepts the fix without breaking a normal control.

    Ordinary adequate route
    A retained response file and the existing test runner can be enough for a consumer regression.
    The check that can reject it
    Run unchanged assertions against old and fixed clients, plus a normal response and malformed or wrong-ID control. Reject a fix that merely hides every error.
    Add a boundary
    Add HTTP for routing, SDK behavior or a shared service case. Prepare, sanitize and verify any captured input before retaining it.
    Conditional shortlist
    WireMock recording/snapshotting or a reviewed Gostly service library can supply HTTP cases. A Postman example can also be saved from a response.
    Evidence
    Plan: reuse the downloadable broken/fixed consumer packet. Its reader check and a captured HTTP replay establish different boundaries.
    Operating effort
    Name the owner for capture permissions, redaction review, case coverage and deliberate refresh. A retained case does not track today’s upstream automatically.
    Planned decision
    Keep the file for the consumer bug. Evaluate HTTP replay only when its additional path is necessary to reproduce the failure.

    Official documentation: WireMock recording and snapshotting · Saving a Postman example

    Keep an unavailable tool distinct from a missing order

    The wrapper and agent preserve unavailable versus not-found results and take the permitted action.

    Ordinary adequate route
    A typed tool-result stub is adequate for answer-policy behavior; a transport stub can exercise the wrapper decoder.
    The check that can reject it
    Deliver 503 and 404 separately: require unavailable versus not-found. Inspect the actual wrapper result, attempt trace and actions against the task rubric.
    Add a boundary
    Add HTTP only when status decoding, routing, SDK attempts or deadlines are part of this case.
    Conditional shortlist
    Keep the existing agent and evaluation harness. If HTTP is required, a Pro Gostly HTTP environment can supply the chosen dependency response; MCP is not required.
    Evidence
    Plan: use the existing test card and decoder as inputs. A decoder check alone does not establish an agent outcome or automatic score.
    Operating effort
    The tool owner maintains result types and retry limits; the evaluator owns the rubric, action observations and acceptable answer.
    Planned decision
    Keep the typed stub for policy checks. Test HTTP when the wrapper’s real transport path is the question; leave missing agent evidence inconclusive.

    Documentation checked 27 October 2026: WireMock Java/OSS and Postman collection-backed saved-example mocks. These document capabilities; the plans above are authored choices, not completed vendor executions. Configure and check meaningful request distinctions rather than accepting any returned 200.

    Keep one task, one comparator and one decision

    Copy this template for your own case. The download includes the same template and all four filled plans above. Record candidate versions, configuration and actual evidence; leave missing proof inconclusive.

    # API mocking task requirements
    
    Task and application assertion:
    Required boundary (function / wrapper / HTTP / state):
    Meaningful inputs and the pair that must produce different outcomes:
    Safe input, starting state, isolation and reset:
    Hard deployment / data constraints (see https://gostly.ai/security):
    Ordinary adequate comparator and why it could suffice:
    Candidate / version / configuration / date / proof source:
    Observed result: PASS / FAIL / INCONCLUSIVE, with actual evidence:
    Missing proof and the check that would resolve it:
    Maintenance owner and import / redaction / reset / refresh effort:
    Decision: KEEP / SWITCH / STOP, reason and next assertion:
    
    Download requirements and decision plans

    Resources

    Continue from the boundary you chose

    Inspect a candidate’s workflow

    Compare the setup and maintained artifacts around a specific HTTP task.

    Explore comparisons

    Check the data and deployment constraints

    Review selected inputs, retained copies, access and connections before choosing a setup.

    Review data controls

    Prepare a meaningful customer situation

    See how related records and expectations can support the experience your team is building.

    Explore the application

    Put the case in front of your application.

    If the selected case needs Gostly, continue with the supported Pro HTTP setup. Optional Team MCP management is a separate choice; your test still owns the application assertions.

    Continue to HTTP setup