Chapter 12. Unit Testing

WHAT'S IN THIS CHAPTER?

  • How to create a unit test application target

  • How to create a unit test bundle

  • How to create an application unit test

  • Running unit tests on the device

You have spent a great deal of time creating your application and you cannot wait to get it into the iTunes App Store, but have you tested it enough? The last thing you want to do is release an application full of bugs. Previously, traditional testing meant running an application interactively and waiting for issues to emerge; there was no consistent arsenal of standard tests.

Over the years, developers have struggled with the most economical way to integrate testing into the development lifecycle and still deliver quality applications on time. The unit test case process has been welcomed into the project lifecycle because of its ease of implementation and repetitive automated execution. Through a suite of standardized test cases, applications are tested as they evolve over time, to identify bugs immediately, not later after implementation. Xcode allows you to easily create a suite of unit test cases to assist you in your quality control phase of your application's lifecycle.

This chapter provides you with the steps to build a sample application followed by the creation of unit test cases you can execute to test your application.

SETTING UP THE ENVIRONMENT

To set up a testing environment, you will be making a copy of your normal application target. Using the copy, you will add the following in ...

Get Professional iPhone® and iPad™ Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.