Applicable to Web Test Automation using Java Selenium Framework running on Windows Machine |
TABLE OF CONTENTS
2. Enabling the Auto healing feature in Application Settings File
1. Auto Healing Overview
Make sure that necessary prerequisites (Java and Maven) are installed. For information on scraping UI elements, refer to the article - algoScraper as an Extension Tool for Chrome or Edge Users and to automate Web Applications, refer to the article - How to Automate Web Applications?
The auto healing feature helps in addressing locator issues caused by changes in the application being tested (AUT).
When the application being tested changes, the scripts may face issues locating specific elements. If this happens, the script might fail to execute. However, with algoQA's auto healing feature enabled, it automatically identifies and fixes these issues with broken or changed elements.
For example, consider a scenario where the web application is updated with its login process. Initially, there is a "Login" button labeled with the ID "loginButton".
<button id="loginButton">Login</button>
Later, the button ID is changed to "signInButton":
<button id="signInButton">Sign In</button>
When the auto healing feature is enabled in a test scenario, the script searches for the element with the ID "loginButton". If it fails to find it, the test will result in failure. Then the feature recognizes that despite the change in ID to "signInButton", the button's functionality remains the same. It adjusts its search criteria to locate the "signInButton", ensuring the test can proceed without any issues.
The auto healing feature uses Large Language Models (LLMs) along with the Document Object Model (DOM) of the web page to suggest locators when the original locator becomes invalid.
How it works:
- This feature will be triggered after all the test cases are executed in a test run. Once the test cases are auto healed, they are re-executed in the same test run.
- The retry mechanism can be used only to rerun the failed test case in the previous test run.
For example, if there are 10 test cases being executed and the second one fails due to a locator issue, auto healing will be triggered only after the 10th test case has been completed. In this case, retry mechanism is used only to rerun the second test case.
2. Enabling the Auto Healing feature in Application Settings File
Perform the following:
After generating the script, download it to your local folder. This folder must contain the script file that you have generated.
- Open the folder where you downloaded the script. For example, if your script is located at AlgoAFScript_202402121131\src\test\java, then navigate to this folder. ApplicationSettings.xml file will be available in the Java folder as shown:
- Open the ApplicationSettings.xml file and locate the setting related to the auto healing feature. Set AutoHealing parameter to True to enable auto healing feature.
- After setting the AutoHealing parameter to True, save the changes you have made to the ApplicationSettings.xml file.
If the failure of the test cases is because of ElementNotFound/NoSuchElement exceptions, then retry method will be triggered when Auto healing is enabled and Retry count is set and retry method will run only for the failed test cases.
Make sure you set the appropriate retry count. To set the retry count , refer to Retry Mechanism. - Open the command prompt within the script folder
- Run the following command for script execution along with auto healing feature.
java -jar algoQAUtil.jar -javaSelenium retry
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article