Skip to content
BENIBIX Learn

Integration Test vs Contract Testing

An integration test runs two or more real parts together to see that they work. A contract test checks each side alone against a shared file of requests and answers. It does not need the other side to be running.

Development🧪 Testing & Quality

Integration Test

A test that checks a few parts work as a team, like code and its data.

An integration test checks that several parts of a system work together. It might run your code against a real database, or call your own API and read the reply. These tests catch bugs that live between parts, like a wrong column name. They are slower than unit tests, often taking seconds each. Most projects have fewer of them than unit tests.

Example
Jack's unit tests all pass, but one bigger test fails. His code saves user_name, but the database column is called username.
Why it matters
Many real bugs live in the joins between parts. Unit tests cannot see them.
Full entry
Development🔌 APIs

Contract Testing

Tests that check an API and the apps that call it still agree.

Contract testing checks that an API and the apps that call it still agree. The agreement is the contract: which requests are sent and which answers come back. The calling app is tested against the contract. The API is tested against the same contract. If either side breaks it, a test fails before anything ships.

Example
Emma's app expects an order to have a total field. When Jack renames it on the server, the contract test fails before release.
Why it matters
It catches changes that break other teams, without running the whole system.
Full entry

In one line

Integration Test
A test that checks a few parts work as a team, like code and its data.
Contract Testing
Tests that check an API and the apps that call it still agree.