User interface (UI) testing has been around for a while. In theory, it's done every day by any one person who is using, testing, or checking an app, but in terms of automation, it's had its fair share of critics.
However, with Swift and XCTest, this has never been easier, and the beauty regarding how we will implement this has an amazing hidden benefit.
Getting ready
Unlike unit testing, when we are testing against a function, piece of logic, or algorithm, user interface tests are exactly what they say on the tin. They are a way for us to test the UI and UX of the app – things that might not have necessarily been generated programmatically.
Head on over to the CocoaTouchUITests.swift file that was automatically generated when we created our project. Again, much like the unit tests, you'll notice some placeholder functions in there. We'll start by taking a look at one called testExample().
How to do it...
With what we mentioned...