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

> Writing tests is annoying, especially in a codebase that keeps changing

Only if you don't have a functional core.

One of the psychology tricks I've learned about unit testing is just how bad sunk cost fallacy affects some people (all the time, and most people some of the time). I've witnessed people pairing for two days to fix a couple of nasty integration tests. That's 3 person-days of work lost on a couple of tests. How many release cycles would it take for that test to pay for itself versus manual testing?

You want the tests at the bottom of your pyramid to be so simple that people think of them as disposable. They should not feel guilty deleting one test and writing a replacement if the requirements change. Elaborate mocks or poorly organized suites can take that away. Which is hard to explain to people who don't see the problem with their tests.

You also want the sides of that pyramid to be pretty shallow, especially if you keep changing your design.



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

Search: