May 2017
I really like these questions! In the last year I've been working more on Django projects, where the default test is the integration test, and the best practice is the integration test backed by the same kind of database that is in production. Needless to say, when I join an existing Django project, I rarely encounter a unit test in its test suite.
I feel like these questions you pose might help in code review, or generally when talking about testing - maybe allow the person with an integration-centric view see the value of unit testing for themselves.
December 2020
I feel like a definition of isolated test is needed at the top. I see test isolation as meaning one of two things.
1. We isolate our tests so that the order tests are run doesn't matter, tests don't depend on each other at all, and ultimately they are deterministic
2. We isolate tests so that they aren't traversing code pathways down a chain of dependencies. i.e. we should be using fakes for the dependencies, so we can test just the code we're testing now.
It seems you are using definition #2 here.
1 reply
January 2021
▶ trentondadams
Indeed! I mean the second one.
This is a case where a bedrock assumption has become unstated: I just don't write tests that depend on the sequence of execution any more. :)
I've added a footnote to try to clarify my meaning.