Hacker News new | ask | show | jobs
by mattmanser 1035 days ago
If you have to 'search around' for your definition and make a dubious appeal to authority without citing any of those experts, perhaps you need to wonder if it's your definition that's wrong.
1 comments

It was not my intention to present you with such a major challenge, my deepest apologies.

https://martinfowler.com/bliki/UnitTest.html

Martin Fowler

Although I start with the notion of the unit being a class, I often take a bunch of closely related classes and treat them as a single unit.

https://medium.com/@_ericelliott/i-use-the-well-known-defini...

Kent Beck

Unit tests test individual units (modules, functions, classes) in isolation from the rest of the program

Although I start with the notion of the unit being a class...

Such great evidence.

Further in the article he goes over exactly why he feels that its allowed to both test a single class or multiple at once, going as far to give a name to them: solitary vs sociable unit tests.

Then, he goes on to, and let me emphasize this, defend against the criticism that other people make that this type of test is not a unit test. (sound familiar?):

Indeed using sociable unit tests was one of the reasons we were criticized for our use of the term "unit testing". I think that the term "unit testing" is appropriate because these tests are tests of the behavior of a single unit. We write the tests assuming everything other than that unit is working correctly.

I'm not sure how thoroughly you're looking to be refuted here but I feel I can't quite do a better job.

Funny thing is, this is not even a very deep insight: the answer to nearly any question in software design can be boiled down to: it depends. This discussion is just the unit-test rendition of "it depends". Why are you so hell bent on having it exactly one way?