Getting Started
Simulating human-machine interactions using UI Automation tools has been one of the best productivity improvements in validating application quality in a scalable and performant manner.
However the possibility of dynamic selector(s) has always caused flaky tests and has been the cause for major reservations for many.
Although experts know ways to robustly develop/fix automated UI tests, they are quite ill perceived by many others and are thereby avoided.
We are going to checkout an easy way handle those dynamic selectors using TestProject.
TestProject provides us with a self healing test automation platform which renews failing locator using AI to identify new locators.
Here is how it works...
For the sake of this tutorial I will be focusing on the test creation part.
For the installation guide check here.
Test Setup
- Create a new test by clicking on New Test and setting any desired name.
- For this tutorial select Web as the test type. And click Next.
Details (Step: 1 & 2)
- Now on the Select web application dialog, click on the Web applications dropdown and select Add a new application for testing. I will be using the the internet heroku app for this tutorial. To follow along set following parameters:
Name: internet heroku app
URL: https://the-internet.herokuapp.com
- Since the AI based Self Healing functionality is available in the Web interface of TestProject, select to store the test on the cloud.
- For simplicity's sake I have used the recording feature to get you familiar with the UI of the test editor. This is the same UI that will assist us later to stabilize identification of the dynamic elements.
Details
Test Steps
- Launch the internet heroku app.
- Click on Dynamic Content link.
Details
- Select the first paragraph on the page for Dynamic Content and check if it is correctly recognized by highlighting it in the UI.
Details
- Refresh page and try to highlight the same element again. This time it will fail since initially the achor was the text content itself which has now changed.
Details
- Fixing the dynamic locator failure is as simple as re-running the test or specific step. TestProject will run AI analysis and finds a replacement locator. To avoid AI bias, you get approval over the selections.
Details
- Once confirmed go back to the test and re-run it as many times as you like and the dynamic content is handled just fine.
Using the power of AI to automatedly fix dynamic locators could never have been any easier. Although many coders are skeptical about record-playback style tools, I urge all to give it a shot. It just might be worth your time.
For more detailed illustration, refer following video:
Top comments (0)