Hide chapters

iOS Test-Driven Development by Tutorials

Second Edition · iOS 15 · Swift 5.5 · Xcode 13

Welcome to iOS Test-Driven Development by Tutorials! This book will teach you all about test-driven development (TDD) — the art of turning requirements into tests and tests into production code.

You’ll get hands-on TDD experience by creating three real-world apps in this book:

By the end of this book, you’ll have a strong understanding of TDD and be able to apply this knowledge to your own apps.

About this book

We wrote this book with beginner-to-intermediate developers in mind. The only requirements for reading this book are a basic understanding of Swift and iOS development.

If you’ve worked through our classic beginner books — the Swift Apprentice and the UIKit Apprentice — or have similar development experience, you’re ready to read this book. You’ll also benefit from a working knowledge of design patterns — such as working through Design Patterns by Tutorials — but this isn’t strictly required.

As you work through this book, you’ll progress from beginner topics to more advanced concepts.

Section introductions

I. Introduction

This is a high-level introduction to TDD, explaining why it’s important and how it will help you.

You’ll also be introduced to the TDD Cycle in this section. This is the foundation for how TDD works and guiding principles on the best way to apply it.

II. Beginning TDD

You’ll learn the basics of TDD in this section, including XCTest, test expressions, mocks and test expectations.

The chapters in this section build an example app called Fitness. This is the premier fitness-coaching app based on the “Loch Ness” workout: You’ll have to outrun, outswim and outclimb Nessie (or get eaten)!

III. TDD with Networking

You’ll learn about TDD and networking in this section, including writing tests for RESTful networking calls, downloading images and using networking clients.

You’ll create an app called Dog Patch throughout this section. Dog Patch lets dog lovers everywhere connect with kind breeders to help get the dog of their dreams.

IV. TDD in Legacy Apps

This section will teach you how to start TDD in a legacy app that wasn’t created with TDD and doesn’t have sufficient test coverage.

You’ll update an app called MyBiz throughout this section. MyBiz is an enterprise resource planning (ERP) app for running a business, including employee management and scheduling, time tracking, payroll and inventory management.

How to read this book

If you’re new to unit testing or TDD, you should read this book from cover to cover.

If you already have some experience with TDD, you can skip from chapter to chapter or use this book as a reference. You’ll always be provided with a starter project in each chapter to get up and running quickly.

What’s the absolute best way to read this book? Just start reading wherever makes sense to you!

Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.
© 2024 Kodeco Inc.