Hacker News new | ask | show | jobs
by Hackbraten 583 days ago
While I agree with you on all your remaining points, one could argue that logic in tests has a non-zero risk of being flawed or buggy on its own. Worst case, a bug in the test's logic and another in the logic under test cancels each other out.

That's why I've made it a habit to write only strictly linear tests in my own code, and use fixtures and parametrization to keep duplication to a minimum.

Ultimately, there's no one true best strategy. Everything is full of trade-offs all the way down.

1 comments

Since I actively supervise my testing, and actively test my tests, I don’t find the prospect of mistakes in my test code to be terrifying.

I don’t understand why the possibility of difficulty with test code should cause me to write shallow, lame test code.