Hacker News new | past | comments | ask | show | jobs | submit login

If the problem is complex, or I don't well understand the requirements, I write tests first.

For complex tasks, breaking down the problem into a single requirement per test helps me understand it better, and ensure I don't introduce regressions while refactoring or adding new requirements.

However, a lot of modern code is hooking up certain libraries or doing common tasks that don't get a lot of value from unit tests (mapping big models to other models, defining ReST endpoints, etc), so I don't generally write unit tests for those (but integration)




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

Search: