As applications grow, it will be harder for everyone to keep track of side effects or ensure that business requirements are met. Therefore, test automation exists to ensure that nothing breaks on your application while you develop new features.
This document is focused on Test Engineers who want to automate testing process using tools like Appium. If you are a developer, please refer to the guide below on how to implement necessary fields for your application:
This Document will focus on Test Automation tool called Appium. The baseline steps and configurations are mostly similar between other Test Automation Tools.
When Smartface Application is built, Smartface Application is no different than any other mobile application. There are no extra steps necessary to fire up Test Automation Tool specific for Smartface.
Install and configure process of Appium is out of scope of this document and will not be covered in this document. Please follow the official guide provided by Appium.
This is how a Smartface Application looks like on Appium:
Coding test automation scripts are outside of this scope and specific to Appium or other test automation tools that you use. For more information, please follow the official guide provided by Appium.
There are 4 main fields that can be used to distinguish elements between each other. Your testing scripts should revolve around one main field and you should use others on special occasions.
To learn more about selectors, please refer to this Appium Guide.
This is resource-id for Android and name for iOS. The developer of the application should assign those fields for you.
Using this selector for scripts is recommended by both Appium and Smartface. It will yield to healthiest result.
When there is Recycling field like ListViewItem or GridViewItem
RecyclerView for Android
TableView for iOS
ID selector will not be able to distinguish elements inside of this view since they are designed to be repeatable and potentially infinite.
On Android, when you get this kind of item by ID, you are going to get multiple results.
This is the human readable text content visible to the users. This selector can be used on specific elements if you are certain that it will be unique.
The purpose of this selector is to ensure if certain text is written in the application. Using this to distinguish between elements might work but not recommended. Only use within specific needs.
This selector is assigned by the operating system itself and it provides where the specific element belongs.
This selector may change over time and not a reliable way to revolve your script based on. Appium also reported performance issues when searching elements based on xpath.
When a native dialog like Alert or Permission was prompted, XPath will have a standard pattern and it can be used to click the elements inside of them. Your developer might not be able to assign proper ID to them since those components are handled by the operating system itself.
This is accessibility-id for iOS and content-desc for Android.
The purpose of this selector is normally to provide better text-to-speech experience with TalkBack or VoiceOver features for impaired users. When this feature is provided, this selector will have a human readable text over them.
More info can be found about accessibility in general in this document:
If you also have accessibility support, this selector will have a different use case and you should be wary when using this selector on your scripts.
If your application is not going to use text-to-speech in the future, you can also use this selector to distinguish different elements.
Not all applications are straightforward and some might have caveats, some might require additional coding.
As stated above, ID of items in ListView or GridView will not yield all of the items inside. When you are searching this view with its ID, the tool will only return currently shown items on current state. As stated above, this view may contain more items than it is shown since they can be reached by scrolling.
The ID of the items for ListView or GridView will be same for each element. If you search by element like this:
Following result will yield:
As stated above, the yielding result only contains the elements that are visible in the current state.
To get a gist of scrolling programmatically with your script, refer to this tutorial by appium.
Since we need to be sure about how many elements or pixels to scroll. You, as a Test Engineer should decide on which method would be best for your use case.
Search with the selector of your desire of ListViewItem using this method.
This will return an array of elements of visible elements.
Define a variable as counter, start at 0.
Define another variable as current height.
You can get the size of a single element using this method.
Increase the counter by element count (5 in the above example) and height count by total height.
Scroll that pixel below using this method.
Search again and repeat the process until you reach the end.
You can also refer to this document to come up with a different approach.