UI testing with XCUITest
UI testing has been around for a while. In theory, it’s done every day by anyone 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, UI testing has never been easier, and the beauty of this approach is that it also has an amazing hidden benefit.
Getting ready
Unlike unit testing, when we are testing against a function, piece of logic, or algorithm, UI 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 necessarily have 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 in the Getting...