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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.