One of the fundamental steps in automating a UI interaction as part of testing is to set up an identification criterion for various elements that the test needs to interact with. It is one of the critical components that define how stable and hassle-free your automation test will perform.
For example, given a Login test scenario with the following steps
- Enter username in Username field (an HTML input element of type INPUT)
- Enter password in Password field (an HTML Password element)
- Click Login button (an HTML Button element)
Username, Password, and Login fields in the above scenario need to be properly recognized using HTML attributes before performing any action on these (such as entering text or clicking on a button).
Traditional approach
A general approach supported and heavily practiced today is using a standard set of static properties for each element depending on its HTML type. For example, elements of type INPUT will be recognized by their ID, name, class or value properties, etc. based on applicability. This approach has been in use since the inception of test automation and has decently served use cases until a few years back.
Current UI technology landscape
With the proliferation of new-age UI frameworks such as Bootstrap, Angular, JQuery, React, etc. and advanced data-binding models, this approach of element identification has started to prove inadequate. User Experience centric applications with subtle interactions and dynamic data has made this process even more complicated. It also tends to be fragile and sensitive to trivial changes in the application UI.
Identifying an element in the web applications today requires a broader context of the element and understanding of spatial relations with other elements on the page. Element in itself may not offer any of its own attributes to uniquely identify. Automation test API frameworks such as Selenium, offer programming approach to building this comprehensiveness into element ID. But it requires a good understanding of the DOM hierarchy at a technical level and custom programming effort. You usually end up going with straight XPath or CSS based approaches, which could prove to be brittle.
A fresh perspective
accelQ brings unique innovation in this complex and important aspect of a test automation cycle with the following benefits:
- Automatically construct unique identification with a combination of neighborhood attributes
- Enable testers to visually analyze element structure
- Provide real-time feedback with match-count during the analysis process
- Ability to incorporate regex or pattern at any attribute level
- Ability to deal with a set of related elements (family of elements) with “anchoring” concept
- Ability to deal with repeat elements and dynamic content
To identify an element, accelQ analyzes the entire neighborhood and finds a combination of attributes required to bring a stable uniqueness. This could include a combination of ancestor or descendant hierarchy, properties of siblings or linked elements etc. as part of the overall neighborhood. The entire analysis process is visualized so that it is accessible for non-technical audience.
Just one more example of how accelQ is driving fresh innovation in Quality Lifecycle Automation!