Unit Tests

Unit tests are exactly what they sound like. Unit tests are small, self-contained segments of code that test very small, targeted units of functionality. Rather than check to see if the whole application works, we can break the functionality into pieces to pinpoint exactly where errors and bugs are occurring.

Unit tests are designed to either pass or fail. Is this feature working the way you want it to, yes or no?

The Parable of the Dinosaur

Here is an example of unit testing gone bad.

In Jurassic Park (the book, not the movie), Dr. Grant asks the scientists how they can be sure that the dinosaurs are not breeding.

The scientists assure Dr. Grant that every precaution has been taken. They engineered the dinosaurs to all be ...

Get iOS 8 SDK Development, 2nd Edition 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.