Xcode UI Recordings Vs Unit Testing

Although they may seem familiar and some people tend to confuse them, Xcode UI Testing and Unit Testing differ notably.

Unit Test is the very much Unit Test we all know, since testing techniques are known. You have complete access to the Main Project and you operate its classes and frameworks like you do as a side library. You can write mocks, stubs, etc.

But UI Test is less familiar.

UI testing differs from unit testing in essential ways.

Unit testing enables you to work within your app’s scope and allows you to exercise functions and methods with full access to your app’s variables and state. Classic.

In the other hand, UI testing exercises your app’s UI in the same way that users do without access to your app’s internal methods, functions, and variables. This enables your tests to see the app the same way a user does, exposing UI problems that users encounter.

That said, be aware that you can not access or even import (@testable import) the internals of your App when UI testing, you can only check what an end user could check.

And what it seems as a limitation is rather safe and powerful.

UI Testing is great for testing complex navigations, fields, data display, credentials and the performance of an App overall.

Recordings are easy to make, not that simple to edit, caveat.

Main Source: Apple Docs

Leave a Reply

Your email address will not be published. Required fields are marked *