---
title: "Integration and contract tests · Agent Wranglers"
url: https://agentwranglers.se/playbook/testing/integration-and-contract-tests
updated: 2026-10-20
licence: "All rights reserved"
---

# Integration and contract tests

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

> Test how your code works with a database, queue or service. Run dependencies in containers, and contract tests between services you own.

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers testing playbook: https://agentwranglers.se/playbook/testing/integration-and-contract-tests`.

## Required

- [Test against the same database engine](https://agentwranglers.se/playbook/testing/integration-and-contract-tests/same-database-engine): Test database code against the same database engine and version as production, never against a different engine or a mock.
- [Check the contract between services](https://agentwranglers.se/playbook/testing/integration-and-contract-tests/contract-tests): When two services you own talk to each other, test the shape of their messages on both sides with a shared contract.

## Recommended

- [Fake only what you do not own](https://agentwranglers.se/playbook/testing/integration-and-contract-tests/doubles-at-the-edge): Replace only outside services, such as a payment provider or an email API, with test doubles. Run your own code as it runs in production.

## Optional

- [Check that outside services still match your fakes](https://agentwranglers.se/playbook/testing/integration-and-contract-tests/verify-the-fakes): At least once a week, run a small test against each outside service to prove your fakes still behave like it.

- Previous: [Unit tests](https://agentwranglers.se/playbook/testing/unit-tests)
- Next: [End-to-end and browser tests](https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests)
- [All chapters](https://agentwranglers.se/playbook/testing)
