Follow @RoyOsherove on Twitter

Brown, Green, Refactor

Having seen enough crappy unit tests to last me a lifetime, I think there should be a parallel to the old “red-green-refactor” (from TDD) –

it’s evil twin brother should be “Brown-Green-Refactor” wherin you’d do a crappy test first, then make it pass (it could pass for the wrong reasons.. like threads, randoms, dates..), then refactor – the code, not the test.

in red-green-refactor you’d write a good test and remember to also refactor the test when refactoring your code, if needed.

RTM ready tests

Software Apprenticeship