Chapter 6
Testing the App

Now that we’ve tied our UI to our code, our simple app has some solid, if basic, functionality. Tap Play, it plays. Tap Pause, it pauses. Everything’s good, and we can just start adding more features, right?

Well, how do we know that everything’s “good”? We have run the app a few times, but have we really pushed the limits of the app? Have we really tried everything that anyone could possibly do to our app? How do we prove that our app is not going to crash before we ship it off to Apple?

And as we start adding features, what proves that those changes work, or that they’re not going to have weird side effects that break the stuff that had been working? Do we only want to start testing the correctness of our code at the end, when we’ve got thousands of lines of code? Caring about the correctness of our code is something that should always be on our mind, not just in a deadline push to QA.

The way we deal with this is to use unit tests. In this chapter, we’ll see how we can use our Swift programming skills to make sure that the rest of our code is doing what it is supposed to.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset