Sunday, March 5, 2017

XCUI: What is XCUI?

XCUI stands for UI Testing in Xcode. It is an automation tool for UI testing introduced by Xcode. So what's UI testing? Why we need to automate the UI testing?

UI testing is testing with the user interface. It usually needs to verify the existence of the target element and then perform specific user actions on it. A same UI testing case may be repeated several times on different platforms to ensure the same behavior working across platforms. Doing these tests manually is dull and time-consuming. Needless to say there is always regression testing required for each release.

XCUI is the tool which helps to automate the UI testing on both iOS and OS X.

How XCUI works? 

You can automate the test cases either by recording or coding. It exists outside of the application and simulates the user actions without touching project code directly. Instead, it works like a proxy over the application to find the target element in the simulator and transfer the command into an interaction.

XCUI finds the target element through the system feature Accessibility. Only if the developer enables the accessibility on the element can XCUI identify the element on the GUI. That means though you are able to see the element by your eyes on the GUI, if the developer does not enable the accessibility on it, you will not be able to catch it through XCUI, neither can you perform any actions on that element in the automation.

XCUI helps you to automate the testing through the XCTest framework. This framework has been integrated with Xcode. It provides multi-classes for you to launch the application, find the object and perform actions. I will talk about this framework in detail in later chapters.

Prerequisite

To use XCUI, you need to pay attention to below prerequisite:
  • OS Versions:  above iOS 9 / OS X 10.11
  • Privacy Protection:
    • iOS : needs to be enabled for development and connected to a trusted host running Xcode. 
    • OS X : will prompt on the first run asking for granting access. Alternatively, you can enable the Xcode at Accessibility category under "Security & Privacy" from System Preference.
    •  


 

No comments :

Post a Comment