Very interesting video with Ian Cooper explaining the big misunderstanding around the word "unit" in the term "unit test"
He is saying that the word "unit" wasn't about the system under test (i.e., class, method, etc), but was about the test itself. "Unit test" is a test which doesn't depend on any other tests.
I think I was pondering the same idea when making the title picture regarding the test pyramid and it exactly the same reason why I was working on the Feature test model (https://aqaguy.uk/pages/ta/ftm/feature_tests/) which helps build effective test coverage disregarding of the approach you choose (test-first or test last).
What do you think? Do you agree with Ian's definition of unit testing?
Top comments (4)
Nice ! have you read Michael Feather's definition on unit testing?
thank you! I am not sure I have, how is it worded?
Michael Feathers gives a clear definition of what is NOT a unit test.
In short, your test is not unit if:
it doesn’t run fast (< 100ms / test)
it talks to the Infrastructure (e.g. a database, the network, the file system, environment variables…)
hm, that sounds reasonable. yet I think it kind of misses the real point. Let's accept that this definition is correct (it might as well be), what real use it gives us?
You might be also interested in this post: dev.to/dadyasasha/unit-testing-is-...