Question
Why using Integration tests instead of unit tests is a bad idea?
Let me start from definition:
Unit Test is a software verification and validation method in which a programmer tests if individual units of source code are fit for use
Integration testing is the activity of software testing in which individual software modules are combined and tested as a group.
Although they serve different purposes very often these terms are mixed up. Developers refer to automated integration tests as unit tests. Also some argue which one is better which seems to me as a wrong question at all.
I would like to ask development community to share their opinions on why automated integration tests cannot replace classic unit tests.
Here are my own observations:
- Integration tests can not be used with TDD approach
- Integration tests are slow and can not be executed very often
- In most cases integration tests do not indicate the source of the problem
- it's more difficult to create test environment with integration tests
- it's more difficult to ensure high coverage (e.g. simulating special cases, unexpected failures etc)
- Integration tests can not be used with Interaction based testing
- Integration tests move moment of discovering defect further (from paxdiablo)
EDIT: Just to clarify once again: the question is not about whether to use integration or unit testing and not about which one is more useful. Basically I want to collect arguments to the development teams which write ONLY integration tests and consider them as unit tests. Any test which involve components from different layers is considered as integration test. This is to compare to unit test where isolation is the main goal.
Thank you, Andrey