til: today I learned

@faizmokh dev notes and everything else in between

20 Aug 2019

Keep Test Logic out of Production

I’m currently reading xUnit Test Patterns: Refactoring Test code and so far it’s been a great read.

Here’s some advices on keeping the test logic out of production code. Don’t.

Testing is about verifying the behavior of a system. If the system behaves differently when under test, then how can we be certain that the production code actually works?

The production code should not contain any conditional statements of the if testing then sort. It should not contain any test logic at all.

comments powered by Disqus