Timeline for Unit Testing Controllers without Mocks
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 1, 2020 at 9:07 | comment | added | rewolf | @ChrisWohlert Ah. Gotcha! Unfortunate that there's such a mix in the meanings of the terminology. | |
| Aug 31, 2020 at 12:12 | comment | added | Chris Wohlert | @rewolf, Okay, that is not the definition I usually work with. I work under the definition given by "The art of unittesting". Which is; A Stub is a fake that you don't assert on, and a Mock, is a fake that you do assert on. I always talk about Fakes, as the category of different substitutions. | |
| Aug 31, 2020 at 9:52 | comment | added | rewolf | @ChrisWohlert That's not true. They're both test doubles, but they are different types. See blog.cleancoder.com/uncle-bob/2014/05/14/TheLittleMocker.html and martinfowler.com/bliki/TestDouble.html | |
| Aug 31, 2020 at 9:37 | comment | added | Chris Wohlert | @rewolf, A Mock is just a Fake. | |
| Aug 30, 2020 at 0:36 | comment | added | rewolf | @GregBurghardt Thanks for you response. My first thought as an alternative is not a real service instance, but rather a Fake. I believe Fake dependencies would still let it be called Unit test. If providing a real instance I agree it would need to be have a configuration without side effects/external deps. Models instances, rather than mocks, can be used in Unit Tests for example. | |
| Aug 29, 2020 at 21:28 | comment | added | candied_orange | @Helena best unit test definition comes from Michael Feathers. Even if you disagree on what to call them, this is how tests should be separated. I need a group of tests so fast I can run all of them with every compile. Can do that if you mix in the slow tests. | |
| Aug 29, 2020 at 20:17 | comment | added | Greg Burghardt | The distinction between unit, integration, and functional tests does not have a unified definition. I had a coworker tell me once that manual end-to-end tests were "unit tests." Not times than not I've heard into tests described as fast and not using anything today resides out-of-process. | |
| Aug 29, 2020 at 19:49 | comment | added | Helena | I don't think Unit test is that clearly defined. At our company we have tests that read and write to a database and still call them Unit tests. Though I do agree that there is a benefit in having tests that finish quicker than that. | |
| Aug 29, 2020 at 17:56 | history | answered | Greg Burghardt | CC BY-SA 4.0 |