3 ms·
There is a distinct and meaningful difference between unit tests and integration tests. flandish is not bikeshedding. Unit tests are about testing a single uni
by PaulStatezny 4y ago
There is a distinct and meaningful difference between unit tests and integration tests. flandish is not bikeshedding.
Unit tests are about testing a single unit in isolation. Integration tests are about testing the integration of multiple units.
With unit tests, the industry's general attitude is that there should be no side effects, such as reading/writing to databases or the disk. Side effects are generally embraced for integration tests, on the other hand.
As a result, unit tests are mostly useful for "pure" functions, ones where the output is 100% derived from the input, regardless of any state external to the function. (Such as database records.) However, a large portion of the industry hasn't realized this and so you get millions of lines of dependency-injected unit tests that really don't provide much value in terms of catching actual bugs. (If these tests were integration tests, they'd catch actual bugs 10x more often.)
A unit test for generating a PDF will not actually involve writing a PDF for disk. An integration test, however, might.
So as I said, this isn't bikeshedding. ;-)