Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Have you tried to only mock/stub external dependencies? I don't really see the point in testing test doubles. Doesn't that make refactoring kinda impossible?
-
Mocking is a fabulous tool that I rarely see used... properly, shall we say. The three camps seem to be:
- Let's try to get around our awfully designed codebase, that wasn't built with unit tests in mind, by mocking these weird singletons, static classes, etc. in weird ways, such as with static mocking, spying odd parts of a class, etc.
- I heard mocking is great, but I don't really like to use it, so I mock only the most specific external method calls I have to in order to try to bash the mocks into shape
- I heard mocking is the BEST THING EVER SO I WILL MOCK ALL THE THINGS AND YOU WILL NOT STOP ME!
Mocking is a fantastic tool, but IMHO only when it's:
- Used on a good codebase, with well designed, modular, highly cohesive classes (i.e. classes that only do one thing)
- Used sparingly, when you actually need to change the *behaviour* of a class for testing, not just its *state*
- When only the minimum amount necessary on a particular class is mocked.
Related Rants
-
linuxxx28Another attempt at trying to get support for weakening encryption recently. An FBI spokesperson said somethin...
-
Root8If you're going to ask for my help ... and then do the opposite of everything i say ... and then complain wh...
-
linuxxx22I was going to be very productive today. My current 100kbs speed is making that any command entered into an s...
Convoluted mocking hell.
random
fucking hell