The most important XCUITest APIs

Fabio Soares
XCUITest
Published in
2 min readFeb 28, 2021

This is the second in a series of blog posts where I share what I’ve learned about XCUITest and how to get started with it.

What’s an XCUITest API?

If you already know what an API is, all good! Jump on to the next session. If you’re not sure of what it means, well, according to Google, is:

A set of functions and procedures allowing the creation of applications that access the features or data of an operating system, application, or other services.

So an XCUITest API basically is something that Apple provided for us to use to create UI tests, more specifically, interact with an iOS app (open, close, tap, swipe, etc.).

Most used XCUITest APIs

The most used ones are XCUIApplication, XCUIElement and XCUIElementQuery. Which essentially allow us to open the app, look for elements, interact with them and terminate the app.

It would go somewhat like this:

The above is just a high-level view of the APIs we’re using, but in an actual test, it would look like this:

Take a look at Apple Developer Documentation

It’s something that could be odd at first and hard to get your way around, but once you start, there’s a lot of value in jumping into Apple’s documentation and learning more about what you can do and how to do it.

So this link will take you to XCUITest APIs, and you’re going to see there’s more APIs we can use. I wrote about are the most important ones for those who are starting writing UI tests.

See you next time!

Check my website for more content about testing, mobile, agile and much more! 👇👇👇

--

--