Tester's Digest

TESTER’S DIGEST

To continue the topic of building better software, this issue considers the question of whether it’s worthwhile for developers to write unit tests, and use Test Driven Development approach.

Topic: Unit Tests and TDD, Worth It?

Why should we write tests? This post, not limited to unit tests, lays out 5 factors: verify correctness; prevent regressions; document behavior; guide design; and support refactoring. I’m with the author.

On the uselessness of Test-Driven Development if you don’t employ the 3rd step of TDD, the refactoring step (remember, TDD is red-green-refactor). The author posits that a whole lot of people “do TDD” but skip refactoring, in which case they are carrying all the costs of TDD without reaping many of the benefits. If your TDD is like that, you’re better off with #NoTDD. Don’t miss the long comment thread that mostly suggests that you, eh, do TDD with refactoring…

Let’s say you don’t side with the no-unit-tests, no-TDD camp; here’s a handy example of using TDD approach to Node.js unit tests using Mocha test runner, Chai assertions library, Sinon for stubs/mocks, with a promise to make you “a 5-dan test-master in theory”:

If you received this email directly then you’re already signed up, thanks! Else
if this newsletter issue was forwarded to you and you’d like to get one weekly,
then you can subscribe at http://testersdigest.mehras.net