Testing plays a critical role in helping developers improve the overall quality of software products. It helps you locate and fix defects before they make their way into production. Thorough software testing enhances code quality and encourages engineers to adhere to...
Understanding the basics
A typical UI (whether for desktop, mobile, or web application) is organized into series of containers nested one inside the other. To locate a given UI object, an automated test uses attributes such as the object ID, class, name, and the path to locating it within its container. Some locators are inherently more stable than others.
Watch the video below for a demonstration identifying UI objects in Ranorex Spy. As you watch, notice that Ranorex Spy includes wildcards (*/*) in the path to an object, which increases the reliability of the selector. If there is a change in the hierarchy of the application, the automated test will still be able to find the UI element.
Building stable locators
The following principles help ensure that your automated tests can find your UI objects reliably.
Avoid coordinate-based recognition
Avoid image-based recognition
Avoid using dynamic IDs
Use the shortest path
Additional best practices
The following practices will help make your UI tests more resilient and reduce maintenance.
Use an object repository
Get your developers involved
Troubleshooting object recognition
Even when using stable locators, object recognition can sometimes fail. Below are tips to help you resolve issues with object recognition.
Invisible UI elements
Snapshots
Related Posts:
6 Strategies To Manage Your Agile Testing Life Cycle
Discover six strategies for managing your agile testing life cycle, including CI/CD, test automation, TDD, collaboration, flexible planning, and metrics
What Is Regression Testing? | Comprehensive Guide
Dive into the world of regression testing and explore techniques, best practices, and the role of test automation tools in the process.
Simplifying Your Testing Process With Codeless Automation
Codeless tools have seeped in through all the pores of digital product development; Wix and Squarespace have introduced significant changes to the way non-dev or even non-tech users can get involved in digital product development cycles.