1 of 1 people found the following review helpful
This review is from: Test-Driven iOS Development (Developer's Library) (Paperback)
A couple of weeks ago, I started reading Test-Driven iOS Development by Graham Lee. I had a blast reminiscing about my days as a Java developer, where every piece of code had a unit test counterpart.
Graham is doing a great job introducing the notion behind unit testing and answering the basic question of why you should write unit tests for your code. The book mentions unit tests can be documentation, help you think about API design and a way to get to know other people's code.
I especially like the way Graham talks about Refactoring. I've read a couple of books on this kind of topic, the difference with Test-Driven iOS Development is that I really enjoyed how Refactoring is a steady topic through-out the whole book.
For me one of the most important reasons for writing unit tests is not so much to show that something works now, but to have that safety net some time in the future, which helps you to make sure things still work after refactoring your code.
Graham uses a sample App, which is available on Github, to show how to approach unit testing on basically every layer of an iOS App. It covers setting up OCUnit in Xcode, a couple of interesting testing frameworks and tools, all the way to testing the view layer with a UITableView.
The most interesting aspects of the chapters about the sample App, was how to design your classes with testing in mind. I've never been a big proponent of a test-first, however, Graham shows with no doubt, that it has advantages. The most important one, in my opinion, is that it makes you think about the API of your class, before starting to code.
Overall, Test-Driven iOS Development is really worth reading, especially if you are new to test-driven development or need some revision on the topic. The book contains lots of code and even though I usually don't mind, I sometimes had a hard time staying on top of it.
If you are not practicing test-driven development today, I highly recommend reading Test-Driven iOS Development and let Graham show you its benefits.