Writing our very first UI Test
Let's start by looking at naming conventions for UI Tests. The key (and best practice) to UI Tests – or any test functions, for that matter – is a good name. Try and write the function name as if you were describing the action you are taking, along with the expected result.
Rename the testExample() function to testCanTapMapButton(). The key here is to always start your function names with the word test. This is how Xcode and XCTest are able to identify your tests.
As you've probably gathered by the description, our first UI Test is going to check that not only is the map button visible, but if it is tappable too, since this is what we expect from the app when it's launched.
Make the following highlighted amendment ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access