Recording and testing

Open Project Navigator and scroll down to the ToDoUITests group. In the group, you'll find a file called ToDoUITests.swift. Click on it to open it in the editor. The structure of the file is similar to the other test cases. In fact, the UI test class is a subclass of XCTextCase, like all our other test cases. Take a look at setUp(). You'll see this line:

XCUIApplication().launch() 

This line launches the app for the UI test. Here, you can already see the difference between unit tests and UI tests. A unit test just loads the classes it needs for the test. It doesn't matter how the classes are put together or how the user interacts with the app. In UI tests, the test runner needs to launch the app in order to be able to ...

Get Test-Driven iOS Development with Swift 4 - Third 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.