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.
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.
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.
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.