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

It was a long thread but it was worth it. It was very interesting and thought provoking to read so many peoples biases, and insights. I am ready to start implementing tests, and I think that as was stated above, tautological unit tests has no value, unless something inside it may be suspectible to change. When you write a unit test, then you add cohesiveness, so you have to update the unit test when your interface change. In other words. You don't write any regression test before your interface is stable. -On the other hand, you may use that same test as a test driven development test up to that point, and let the test be the manifesto of the specification. For simpler cases, it is often best to use assertions, that you can annhilate when you ship anyway. Apple says that Unit tests are for the model more than the view, but may be used in the controller, so those places I am inclined to use NSAssert. I don't have to throw away unit tests that takes a long time to run in Xcode either, as I can just disable them.

I must also say that I am reluctant to write large tests, and "mock objects" to provider large environments for the code to run in, as that may introduce new bugs and more work.

I guess (hope) the correct stratagems for when to implement tests, and when not comes with experience!



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

Search: