Essential Developer

View Original

Composing View Controllers pt.4: Integration Tests vs. Contract Tests vs. UI Tests

Watch on YouTube

In this video, we're going to improve our Swift View Controller Lifecycle Observers framework by increasing the test confidence with Integration Tests.

We’re going to discuss the difference between UI Tests, Integration Tests and Contract Tests (Unit Tests). We’ll also bring up some ideas on when to use one over the others.

The tests we wrote in the previous episode are usually called "Unit Tests" but, in the context of our framework, we like to call them “Contract Tests.” We call them “Contract Tests” because they ensure we’re using the UIViewController Container API correctly, as defined in Apple’s documentation (or the contract!).

You can find the source code on GitHub.

Learn more about Implementing a Container View Controller from Apple Docs.

Subscribe now to our Youtube channel and catch free new episodes every week.