Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Did you ever actually refactor code with a significant test suite written under heavy mocking?

I have. The assumptions you make in your code are there whether you test them or not. Better to make them explicit. This is why TDD can be useful as a design tool. Bad designs are incredibly annoying to test. :)

For example if you have to mock 3 other things every time you test a unit, it may be a good sign that you should reconsider your design not delete all your tests.



It sounds like your argument is “software that was designed to be testable is easy to test and refactor”.

I think a lot of the gripes in the thread are coming from folks who are in the situation where it’s too late to (practically) add that feature to the codebase.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: