Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 2
    "In unit testing you must only test the functionality of one class". Absolute nonsense. The single biggest impediment to devs writing good automated tests is this crap about unit tests only being allowed to test a single class/method or whatever. Whoever dreamt up this claim made a mistake comparable to null mistake. Commented Sep 15, 2021 at 8:26
  • @DavidArno, would you call that unittest? And how is it different from integration test? I am confused about unittest going through Zed Shaw's 'Leard Python the Hard Way' chp 47 on automated testing. Zed's test_ functions do not correspond 1-to-1 to the functions. Commented Jan 3, 2024 at 11:18
  • 1
    @Johan - that is the debate about unit testing - does "unit" mean "unit of code", or "unit of work". If using "unit of code" you tend to mock everything, then you can end up with lots of strong coupling between implementation and tests, and also lots of low value tests (e.g. does my API method call the service method with exactly the same parameters passed into it?). Using "unit of work" (mocking only db/storage etc) then you lose the ability to exactly pin-point bugs and can easily blur the lines with integration/e2e testing. Which to use is more of a cultural rather than technical decision Commented May 9, 2024 at 11:19