Test smells before code smells…

Writing smelly tests is just as easy as writing smelly code. You can spin your wheels making sure you’re doing it right…

“this object validates input AND does data access… that’ll be a gnarly test”

“I need a comparison method for this ‘God Object’ for assertions… should I add the method to production code?”

“guess I need mocking framework, but the lib’s documentation uses Repositories… do I have to write Repositories for all my data access!?”

The problem with being afraid to write smelly tests is that it can keep you from getting code written in the first place. Not writing code at all is worse than writing smelly tests.

This is why I suggest going ahead and writing smelly tests for legacy code when you see it for the first time. Just write! You’re in a unique situation where someone wrote a ton of code and never went back to make it better. Now is your chance to use tests to make it better.

When you get that feature, bugfix, refactoring, optimization done… you can tackle the test smells you may have left behind. To help you out, I’ve built a handy set of cheat sheets for you to hang on your wall for finding the root causes of important test smells.

Click here to download the cheat sheets

Thanks,

Nick

P.S. I’ve been getting a ton of good feedback about my book Intuitive Testing with Legacy ASP.NET MVC.

Remember, I’m launching the book at an introductory price this week. On top of that, I’m offering a limited-time promo code for my subscribers: bpemail. You don’t want to miss out on this discount - it ends on Friday!

Buy Intuitive Testing with Legacy ASP.NET MVC