3 ms·
Sounds good in theory. In practice there is one problem with having integrations tests only. The test are generally simple: they pass or they fail. A unit test
by pleasecalllater 9y ago
Sounds good in theory. In practice there is one problem with having integrations tests only. The test are generally simple: they pass or they fail. A unit test tests just a small functionality, so when it fails, it's quite easy to find out the problem.
When an integration test fails, then we can spend hours debugging the whole stack of layers trying to find out the real problem.
I had this situation once. Every failing integration test ended with hours spent on writing unit tests for all the places used by the test.
- fpoling 9y agoFrom my experience an integration test failure that requires significant efforts to investigate can only be covered with unit tests after one knows where the problem comes from. One cannot realistically write a bunch of unit tests and expect them to cover the problem unless one already knows about the problem.
- ndh2 9y agoIt's called shotgun unit testing.
- alien_at_work 9y agoFor me, one of the biggest issues with integration tests is the code coverage numbers mean nearly nothing. I've seen an "integration only" tester proudly display his single test with 90% coverage. I asked him to run it again and it was 2% because a condition changed. So this means that for all the branches your code can take, an integration test is taking one specific one at each point all the way through for that test. All over branches, through the entire call stack are unverified.