3 ms·
Article: > "Originally the unit in “unit test” did not refer to the system under test but the test itself. Meaning the test can be executed as one unit and doe
by theteapot 5y ago
Article:
> "Originally the unit in “unit test” did not refer to the system under test but the test itself. Meaning the test can be executed as one unit and does not depend on other tests to run upfront (see here and here)."
I find the links provided to support for this proposition underwhelming. In any case it matters zero. No-one interprets unit test that way any more. Everyone interprets it the other way round, like defined on Wikipedia:
> "In computer programming, unit testing is a software testing method by which individual units of source code—sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures—are tested to determine whether they are fit for use. Unit tests are typically automated tests written and run by software developers to ensure that a section of an application (known as the "unit") meets its design and behaves as intended. In procedural programming, a unit could be an entire module, but it is more commonly an individual function or procedure. In object-oriented programming, a unit is often an entire interface, such as a class, or an individual method." -- https://en.wikipedia.org/wiki/Unit_testing https://en.wikipedia.org/wiki/Unit_testing
It's generally accepted good practice to not have dependencies between unit tests. Dependencies between unit tests are generally accepted as bad practice.
- deleted 5y ago[deleted]
- js8 5y agoYou could also say that no dependencies between unit tests imply no dependencies between modules under test. Hence, the article's claim is incorrect, as their interpretation implies the interpretation they are refuting.
- thom 5y agoThe central idea of a ‘unit’ test is that its failure should implicate one, and only one, part of the codebase. So while isolating tests is a necessary part of this (stale state from other tests would cloud the reasons for failure), I’ve never heard this isolation proposed as the primary feature of a unit test.
- bluGill 5y agoI've come to disagree with the idea that a test is for only one part of the code. In the real world if a test breaks you know what broke it: the last change you made. Thus it doesn't matter in the worst case, and in the best case it warns you of a weird situation more isolated tests wouldn't have caught. There is such a thing as tests that fail randomly of course. Investigate and fix them.