API testing

Mock a downstream dependency

Medium70 pts~25 min
  • Service virtualisation
  • Test doubles
Practice app · Acme REST API

A live REST + GraphQL API with auth, validation, pagination, rate limiting and an interactive request console.

BASE_URL
/api/practice
Console app
/lab/api-testing-mock-a-downstream-dependency

Your starter code already declares BASE_URL — call the API relative to it.

Objective

Use the payments endpoint as a virtualised payment gateway and test the happy path against it.

Your task

  1. 1POST BASE_URL + "/payments" with { "amount": 49, "cardNumber": "4242424242424242" }.
  2. 2Assert 200 and status === "approved".
  3. 3Assert transactionId is a non-empty string.

Acceptance criteria

  • POST /payments returns 200
  • At least 3 assertions pass

Fixtures

apiKey
tqa_live_key_123
basicUser
admin
basicPassword
secret
username
qa@target.dev
password
Test@123

API testing · API Testing · Mocking & virtualization