From: Phlip Date: 2008-08-02T22:24:12+09:00 Subject: Re: unit testing advice David A. Black wrote: >> - live users >> - random numbers >> - hardware - networks, robots, tape drives, the clock, etc >> - system errors >> >> If your B object is not on the list, you should not mock it. > > I wouldn't narrow it down that strictly. It can depend on the purpose > of the test, as well as the profile of the thing you're mocking. You can also avoid mocking the clock by setting a time to 2.minutes.ago, for example. (And "hardware" covers "profile". We don't care if B takes a trillion clock cycles, on a magic CPU that can run them all instantly.) However, some teams go mock-crazy (even those subjected to high-end consultants), and mock everything for no reason. Don't do that! -- Phlip