I have encountered conflicting definitions of “unit test”. Considering the concept is so prolific I would like to ask for a definition of “unit test” in the context of general purpose programming methodologies.
The current Wikipedia article seems to imply a “unit” is “a requirement”.
Another approach I’ve encountered(eg) is a “unit” is “everything”. Methods, functions, constants, macros, templates etc.
Which gets silly quickly when refactoring a class results in having to delete tests because the set of private methods has changed. So: a “unit” is “everything publicly facing”. This one sounds better but also complex.
Source: Read More