Timeline for (Why) is it important that a unit test not test dependencies?
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 18, 2023 at 6:43 | history | edited | JacquesB | CC BY-SA 4.0 |
added 300 characters in body
|
Apr 7, 2023 at 11:09 | comment | added | JacquesB | @candied_orange good point about the vagueness, I have updated the answer to be more specific about when mocking is appropriate. | |
Apr 7, 2023 at 9:57 | history | edited | JacquesB | CC BY-SA 4.0 |
added 1169 characters in body
|
Apr 6, 2023 at 19:01 | history | edited | JacquesB | CC BY-SA 4.0 |
added 87 characters in body
|
Apr 6, 2023 at 17:03 | comment | added | JacquesB | @candied_orange The oldest reference I could find is from Kent Becks documentation to SUnit, the very first unit-testing framework. web.archive.org/web/20150315073817/http://www.xprogramming.com/… It talks about a "unit of testing". It is clear the "unit" is referring to the test, not to the code-under-test, for example in: "When you talk to a tester, the smallest unit of testing they talk about is a test case." | |
Apr 5, 2023 at 15:12 | comment | added | candied_orange | Mostly agree. "unit" refers to the test is new to me. Can you cite to support the claim? The list of dependency exceptions here is short and vague. For things that need mocking being "external" is often true but not the point. Tests need to be fast, deterministic, parallelizable, and not need special configuration. Making a test be those things is a good reason to mock. Mocking because you can mock is not a good reason. Isolation for isolations sake is not a good reason. I only have one more reason to mock that I detailed here. | |
Apr 5, 2023 at 14:39 | history | edited | JacquesB | CC BY-SA 4.0 |
added 2 characters in body
|
Apr 5, 2023 at 10:20 | history | edited | JacquesB | CC BY-SA 4.0 |
added 174 characters in body
|
Apr 5, 2023 at 8:58 | history | answered | JacquesB | CC BY-SA 4.0 |