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

> what's the point of asserting that add(2,2) will yield 4 if you've already been thinking about that

There have been plenty of times when I have run a test like add(2,2) and I don't get 4. Usually it's a typo or some logic error rather than my "not thinking about it". Just like what was mentioned in the article, the alternative is manual testing.

One benefit of testing is that then you start thinking about edge cases you didn't think about before. My common thought process: "What other tests should I add in here? What are the boundary conditions that are possible? Oh, running this function with an empty list even though it generally should have something in it. Huh, I didn't even account for that in my code!"



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

Search: