Create a Place to Play with Tests

Assertions give unit tests a way to state their expectations. The tests fail if these expectations aren’t met. Let’s make a place outside of your actual projects where we can experiment with how they work. Throughout this book, you’ll learn new concepts by playing in these safe spaces. Then in the exercises at the end of each chapter, you’ll begin applying these concepts to your own code.

When it comes to learning, reading doesn’t come close to doing. If you take the code from the examples and type them into your computer, your learning will go deeper. So I encourage you to open your IDE of choice and give it a go. (The examples will use Xcode.)

Let’s start by making a place where we can play with tests. ...

Get iOS Unit Testing by Example 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.