A delivery integration reads orders from an API. The next release still returns a successful response, but a previously empty contact field comes back as an explicit null. The order importer treats it as an instruction to erase the delivery contact. A health check sees a success. The warehouse sees a missing phone number.
An integration contract captures the responses, requests, and meanings your workflow depends on. Keep it small enough to read during a change review.
What an order import contract test covers
- Response shape ID, contact, status and next page
- Field meaning Missing contact leaves the value alone
- Business outcome Dispatch retains the last approved contact
Write the smallest useful agreement
List the fields the importer reads, the accepted values, and the meaning of an omitted field versus an explicit null. Include how the API signals the last page and how it responds when a record changes mid-read. Agree with the API owner on which changes are compatible and which need a coordinated release.
When the provider is external, record your own assumptions in the repository. Keep a fixture from a safe test environment and give one person the job of reviewing unexpected changes.
Turn surprises into test fixtures
Take an existing order with an approved contact. Run one fixture where the incoming record omits the contact and another where it explicitly says the contact has been removed. Assert the dispatch screen shows the intended result in each case. Add one two-page example and verify that every distinct order is imported exactly once.
Use a representative error fixture as well. When the provider asks the client to retry later, assert that the job retains its checkpoint and resumes from it. Otherwise a short API interruption can lead to missing orders or a sweep that restarts from the beginning every time.
Run the contract where it can catch change
Run the fixture tests on every release touching the importer. Send a safe representative request against the provider’s test environment before release when you have access. Have the integration owner review any difference in field behavior. The decision to change the importer or ask the provider to restore the contract belongs with the team that understands the order workflow.