Intelligent Page Objects
Automation code that self-maintains - Learn how to effectively reduce test maintenance with intelligent Page Objects that use multiple locators.
Note: This requires the use of the UI Scanner, learn more by checking out this documentation page.
Avoiding brittle Page Identifiers that cause Test Scripts to fail: As with traditional Page Objects, there’s one Element Identifier, i.e. an XPath per Object in a typical Application. Therefore, a changed Object in the Application causes a Test Script to fail. So here we can use a technique to avoid shore-up the brittle nature of Page Identifiers.
Benefit: Quality Modeller apply multiple Locators per Element.
What’s to know? They go beyond one-to-one mapping. Therefore, as Automation gets executed, the framework learns and dynamically updates the Locators.
Part 1: Scan and upload Page Objects
Part 2: In Quality Modeller, locate the recently uploaded Page Object. To do so, click Models (Explorer in the updated UI) from the sidebar. Swivel open the Object and see the Parameters of a multitude of the XPath and Tag name Locators. This moves away from the one-to-one mapping to multiple Identifiers.
Part 3: Create some Tests by Overlaying the functions from the Page Objects. To do so, first in Models (Explorer in the updated UI) click New Model > on the Canvas drag a Start node > with the Start Node selected in the Automation pane navigate the directory to locate one of the modules from the Page Objects.
Part 4: With a flow created, go in and Generate some Tests. To do so, go to the top Ribbon menu > click the Test Generation tab > choose and click the Generate (plane) icon > in the Test Cases (Scenarios in the updated UI) pane. Click the Run (arrow) button and Execute it.
See how Quality Modeller can handle changes to an Automation script:
Part 5: In the download Java framework script, see the Classes embedded | the Log-in Page Objects | Test Definition going through the Scenarios Generated in Quality Modeller.
Part 6: In the Definitions file of the Webpage being tested make some changes to the Id's, possible reorder them. Run the Script and it passes.
Part 7: In the Notifications panel of Quality Modeller > see that 2 of the Page Objects were Auto-magically (sic) updated. To verify, open the Page Object > see a Magic wand icon saying that the Identifier reflects it’s been updated with the latest changed Identifier related to the underlying Application).