About the client
A European multi-asset broker and prop-trading operator serving retail traders across several markets. Besides brokerage, it runs funded-trader evaluation programmes, trading education and member communities on the same platform. The client is not named in this case study.
The challenge
The 12 platform services in scope expose 332 API operations, from market data and order routing to funded-account evaluation and payments. Nothing tested its APIs automatically: every release waited on a manual regression pass that took about a week, so even a small fix could not ship any sooner.
The OpenAPI contracts had drifted from real behaviour, so tests could not simply follow the documents. Some API calls have real consequences placing orders, resetting accounts, charging a payment gateway yet there was no isolated test environment. Access rules differed by service, and one wrong rule could expose another trader’s data.
The client needed a regression suite that runs in minutes with one command, checks behaviour and permissions against the live API, and cleans up after itself on the shared environment.
What we built

Headless login for automation. The web client allows only a browser OAuth flow and rejects the password grant. We implemented Authorization Code + PKCE without a browser: the suite submits the identity provider’s login form itself and exchanges the returned code for a token. Tokens for the admin and regular-user test accounts are fetched once per run and cached, so four parallel workers do not flood the identity provider and trip its brute-force protection.
Resilient API client with a built-in audit trail. Every request goes through one thin client that retries on 429 and 502/503/504, honouring Retry-After, for up to five attempts. It deliberately does not retry a 500, so real server bugs stay visible. Each call attaches its full request and response to the test report, so a failure can be diagnosed without re-running it.

Contract-first test design, verified against reality. Every service’s OpenAPI contract was turned into tests from scratch in Playwright Test and TypeScript, one folder per service and one spec per flow. Before a behaviour was asserted, it was probed on the live API.
Safe on a shared environment. Per-service factories create every prerequisite a test needs an instrument, a challenge with a draft version, a course with its sections and delete them newest-first after the test; a post-run sweep catches anything a rate-limited delete missed. Order submission, account reset, payouts and purchases are exercised only against non-existent ids or invalid bodies, so nothing is dispatched. Global settings and the one real profile the suite edits are snapshotted and restored.
Permission matrix in every service. Each service is tested with an admin and a regular-user account: 401 without a token, 403 on admin-only routes, 404 rather than 403 where ownership hides another user’s data, and open access where the product is meant to be public.
Key integrations
Keycloak identity provider (OAuth 2.0 / OIDC with PKCE), the platform’s trading, prop-trading, payment-gateway and reference-data services, and their OpenAPI contracts as the test specification.
The hardest part
Running nearly 900 tests in parallel on a live, shared environment without false alarms and leaving no test data behind.
The platform is eventually consistent: data written by one request may not be visible to the next for several seconds, especially with many tests running in parallel. A test that reads the data back immediately would report a bug that isn’t there, and a suite that raises false alarms soon stops being trusted. Instead, every check that reads data back after a change polls at short, growing intervals and passes as soon as the data appears; it fails only if the data never shows up within a fixed limit.
Cleanup turned out to be its own specification. Some deletes are idempotent, others return 404 on repeat; some cascade to children, others refuse while children exist; a funded-account programme cannot be deactivated once live. Each rule was discovered on the live API and encoded in the factories and the post-run sweep.
The outcome
- Regression time: about one week of manual checks → about 12 minutes for a full automated run of nearly 900 tests.
- API coverage: no automated tests → 12 services covered by functional, negative and permission tests.
- Defects surfaced: 15 API issues found and logged for the platform team: 13 defects across 9 services, from 500 errors on empty or invalid requests to a challenge price silently ignored on write, and 2 services whose access rules contradict their documentation.
- Access control: permissions for both test accounts are re-checked on every run, instead of being assumed from the documentation.
- Environment hygiene: the suite is designed to leave no test data behind, so the shared environment stays usable for the rest of the team.