News for hackers. Stuff that matters.
Re:Zen and the Art of Unit Testing by stephen on Wednesday March 15, 2017 @11:47AM (#13876891)
Agreed.

A test should care about: input, "do something", output.

Then you can refactor the heck out of "do something" and your test (which is ideally documenting the use cases you need to support) doesn't have to change at all.

For me, preferring stubs (dummy implementations of your external dependencies), when possible/appropriate, is a good way to avoid "your test is just a repetition of which method calls your implementation makes":

http://www.draconianoverlord.com/2010/07/09/why-i-dont-like-...

There are no comments on this comment yet.