Preface

iOS projects have become bigger and more complex. Many projects have already surpassed desktop applications in their complexity. One important strategy to manage this complexity is through the use of unit tests. By writing tests, a developer can point out the intention of the code and provide a safety net against the introduction of bugs.

By writing the tests first (Test-Driven Development), the developer focuses on the problem. This way, they are forced to think about the domain and rephrase a feature request using their own understanding by writing the test. In addition to this, applications written using Test-Driven Development (TDD) only contain code that is needed to solve the problem.

As a result, the code is clearer, and the developer gains more confidence that the code actually works.

In this book, you will develop an entire iOS app using TDD. You will experience different strategies of writing tests for models, View Controller, and networking code.

Chapter 1, Your First Unit Tests, walks you through your first unit tests using Xcode and discusses the benefits of of using TDD.

Chapter 2, Planning and Structuring Your Test-Driven iOS App, introduces the app you are going to write through the course of this book and how to set up a project in Xcode.

Chapter 3, A Test-Driven Data Model, discusses the TDD of a data model.

Chapter 4, A Test-Driven View Controller, shows you how to write tests for View Controller, and describes how to use fake objects to isolate micro features for the test.

Chapter 5, Testing Network Code, teaches you to test network code using stubs to fake a server component before it is developed.

Chapter 6, Putting It All Together, walks you through the integration of all the different parts developed in previous chapters and shows the use of functional tests.

Chapter 7, Code Coverage and Continuous Integration, shows you how to measure the code coverage of your tests using Xcode and introduces you to continuous integration.

Chapter 8, Where to Go from Here, wraps up and shows you the possible next steps to improve your acquired testing skills.