Forward Deployed Engineering Tutorial · Integration Engineering · Lesson 13 of 24
Testing Integrations
Test integrations without breaking customer systems: recorded fixtures, contract tests, sandboxes and synthetic monitoring.
Layers of testing
| Layer | What | Runs |
|---|---|---|
| Unit tests | Mapping and validation logic on sample records | Every commit |
| Fixture tests | Recorded real responses (anonymised) replayed against the client | Every commit |
| Contract tests | Check the API still returns the fields and types you rely on | Daily against the customer's sandbox |
| End-to-end | A test record flows through the whole pipeline in staging | Before releases |
| Synthetic monitoring | A canary request or record in production | Continuously |
EXPECTED = {"id": str, "amount": (int, float), "currency": str, "status": str}
def contract_check(sample):
problems = []
for field, types in EXPECTED.items():
if field not in sample:
problems.append(f"missing field '{field}'")
elif not isinstance(sample[field], types):
problems.append(f"'{field}' is {type(sample[field]).__name__}")
return problems or ["contract OK"]
print(contract_check({"id": "inv_1", "amount": 120.5, "currency": "EUR", "status": "paid"}))
print(contract_check({"id": "inv_1", "amount": "120.50", "currency": "EUR", "state": "paid"})) # API changed
Output
['contract OK'] ["'amount' is str", "missing field 'status'"]
Practical tips
- Ask for a sandbox or test tenant in week one.
- Store anonymised fixtures, never real customer data, in your repository.
- Alert when a contract test fails: APIs change without notice more often than you'd expect.
Test yourself
Where should test fixtures based on customer API responses come from?
Recorded responses with all customer data anonymisedProduction data copied as-isMade-up fieldsScreenshots
Show answer
Answer: Recorded responses with all customer data anonymised
Fixtures should be realistic in shape but contain no real customer data.