Functional tests
Until now, we have written unit tests to drive the implementation. Unit tests test a small micro feature (a unit of the project) under controlled circumstances.
On the other side of the spectrum are functional tests, which test the functionalities of the app in terms of how a user would approach them. The user does not care how the app they're using is implemented. The user cares about what they can do with the app. Functional tests help make sure that the app works as expected.
In this section, we will add a functional test using UI tests, which were introduced with Xcode 7. We will take one functionality (adding a to-do item) and write a test from the user's perspective.
Adding a UI test target
First, we need to add a UI test target to our project. In Project Navigator, select the project and click on the button at the bottom of the view showing the target list:
From the template chooser, go to iOS | Test | iOS UI Testing Bundle. Let the name remain as Xcode suggests it, click...