Hacker News new | ask | show | jobs
by lm28469 2582 days ago
>There are obvious solutions: Mocking everything, removing global state, writing more robust test setup code... But who has time for this?

If you do it from the beginning and structure your code in a testable way it doesn't take much time. It saved me a few time in my current company; make a small change -> turns out it breaks a feature from 3-4 years ago that no one even remember -> look at the tests -> understand the feature as well as why what you did broke it.

If you try to do it after X years of coding without thinking about tests you're doomed though.