4 ms·
I have been a big advocate for testing only the public interface of your code, but sometimes you can't just avoid it, when you have a really complex piece of fu
by kissgyorgy 7y ago
I have been a big advocate for testing only the public interface of your code, but sometimes you can't just avoid it, when you have a really complex piece of function, you got to test it to gain confidence.
Other than that, I hope these are not a surprise for anybody who is writing tests on a daily basis.
- ptx 7y agoKent Beck said on a podcast (discussing TDD with David Heinemeier Hansson) that he sometimes writes tests coupled to the implementation details as he's developing, but later (if it seems like a maintenance burden) he will delete those tests.
- ncmncm 7y agoThere's no shame in making public interfaces just for test access. You can change them freely, along with the tests, if needed, if you have given them scary names; or even delete them and the tests that use them, if warranted. In the hardware world they call this "design for test" and reserve pins or connectors just to attach test jigs to. I have encountered reviewers who were horrified at the idea, but I just laughed.