Unit Testing iPhone Apps by Dan Pilone and Courtney Nash


Summary: make yourself comfortable with unit tests

Unit testing is quite important when it comes to writing good, fault proof applications. Nobody likes to write Unit tests unless they got used to it. If you start using them, you will probably feel uncomfortable when tests are missing. Unit testing is basically a way of making you confident that application works almost like expected. You can’t filter everything, but still – having few tests is better than having none. Developing for iPhone is not that far from any other development. If you want to have your application appreciated by users, it should never fail unexpectedly. Even more, there is another fence that forces you to develop error prone applications – Apple Store validation process. If you want your application to be there, you have to make it correctly. Dan Pilone and Courtney Nash guide you through the process of setting up and using Unit tests. At the very beginning you will be told how to prepare your working environment and how to set up things – this is the place where every Unit testing starts. Dan shows not only good examples but he shows bad practices as well. This way, he smoothly changes the topic and goes directly into refactoring the code. In refactoring section, he basically shows us how should we re-factor the code in order to make it “Unit test friendly”. If you have already built code, you have to re-factor it in order to implement tests. On the other hand, if you start coding from the scratch, you can develop using test driven approach instead. This method of developing Unit tests is discussed by Dan and Courtney as well. What is important here is that Dan not only gives you technical details but also the background of the process. Why should you do Unit testing, how should you start, how can you benefit from it.

What I like in this video training is that Dan faces issues that surprise him, which makes this video quite trustworthy. I also like his real life examples. I have, however, few remarks when it comes to the video and the content. First of all, you can hear some background noise within first two parts. It might me distracting sometimes – if you got used to it, you will manage to go further. Another thing is that there is really annoying “feature” of iTunes when it comes to O’Reilley’s videos. From time to time videos contain useful comments at the bottom of the screen. However, if you press Pause, you get whole comment covered with iTunes panel. This is quite frustrating. If you want to solve this “issue” simply drag your iTunes movie control panel somewhere at the top of the screen and you are done. If it comes to content related issues, this is just picking holes in it. Dan mentions that he prefers to use test case names that contain “should do something” in order to make code cleaner. You can see later on in the code, that he uses standard test names “testSomething” through out the video. Another issue is that he works with the code that can not be found at O’Reilly’s page – this is a pity. I’d rather to have really simple Unit test example with code that I can download and test for myself.

If you ask me, whether the video is worth seeing or not, I can only say – yes it is. I got lazy over past few years. I don’t want to ‘google’ for everything I need. Sometimes, I simply want to lay back, watch the video, and get the knowledge I need, while at the same time I can relax :)

Product page: http://oreilly.com/catalog/0636920016519/