https://github.com/hjsblogger/auto-healing-with-selenium
This repo deep dives into running Auto-Healing tests using Selenium and LambdaTest
https://github.com/hjsblogger/auto-healing-with-selenium
auto-healing automation-testing lambdatest selenium selenium-java selenium-webdriver
Last synced: 7 months ago
JSON representation
This repo deep dives into running Auto-Healing tests using Selenium and LambdaTest
- Host: GitHub
- URL: https://github.com/hjsblogger/auto-healing-with-selenium
- Owner: hjsblogger
- Created: 2023-08-06T13:16:09.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-18T18:30:14.000Z (about 2 years ago)
- Last Synced: 2025-01-14T01:44:18.896Z (9 months ago)
- Topics: auto-healing, automation-testing, lambdatest, selenium, selenium-java, selenium-webdriver
- Language: Java
- Homepage:
- Size: 31.3 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Auto Healing in Selenium using LambdaTest
In this 'Auto Healing in Selenium using LambdaTest' repo, we have covered the following use cases:
* Auto Healing of live document
* Auto Healing of document (under development)The following websites are used for the purpose of demoing the use cases:
* [LambdaTest E-commerce Playground Registration Page](https://ecommerce-playground.lambdatest.io/index.php?route=account/register)
* [LambdaTest E-commerce Playground Product Page](https://ecommerce-playground.lambdatest.io/index.php?route=product/category&path=57)
* [Demo Login Page created by Florin Pop](https://codepen.io/FlorinPop17/pen/vPKWjd)The [Demo Login Page](https://codepen.io/FlorinPop17/pen/vPKWjd) is hosted locally and run on port number 8080 (or any other port) that is currently free on the system.
## Pre-requisites for test execution
For localhost testing, we need to start the tunnel. To do the same, download [Underpass](https://www.lambdatest.com/support/docs/underpass-tunnel-application/#downloading--installing-the-underpass-tunnel-application) from LambdaTest to establish an SSH tunnel between the OS & LambdaTest cloud server(s).
Load the [demo login page](https://github.com/hjsblogger/auto-healing-with-selenium/tree/main/local-project/dist/index.html) by triggering the ```php -S localhost:8080``` command on the terminal.
Before running the tests on LambdaTest Selenium Grid, you need to set the environment variables - *LT_USERNAME* and *LT_ACCESS_KEY*. Here is how you can do the same:
## Configure Environment Variables
Before the tests are run, please set the environment variables LT_USERNAME & LT_ACCESS_KEY from the terminal. The account details are available on your [LambdaTest Profile](https://accounts.lambdatest.com/detail/profile) page.
For macOS:
```bash
export LT_USERNAME=LT_USERNAME
export LT_ACCESS_KEY=LT_ACCESS_KEY
```For Linux:
```bash
export LT_USERNAME=LT_USERNAME
export LT_ACCESS_KEY=LT_ACCESS_KEY
```For Windows:
```bash
set LT_USERNAME=LT_USERNAME
set LT_ACCESS_KEY=LT_ACCESS_KEY
```Also, add *LT_USERNAME* and *LT_ACCESS_KEY* in the *set-env* section in the [Makefile](https://github.com/hjsblogger/auto-healing-with-selenium/blob/main/Makefile)

Run ```make set-env``` to export the desired environment variables (i.e. *LT_USERNAME* and *LT_ACCESS_KEY*).
## Test Execution
### Execution of tests [with unchanged locators]
To start with, we run the tests (with original locators) by invoking ```make org-test``` to execute tests that have locators that have not been modified during the development process. Hence, we will not observe any auto-healing of locators in this test execution cycle.

Test execution is triggered with all three tests running in parallel on LambdaTest Selenium Grid.
Shown below is the execution snapshot which indicates that the test execution was successful.
### Execution of tests [with healed locators]
The test code with modified locators is present in *AutoHealingTest.java* Run the command ```make auto-heal``` to execute the tests that have locators healed by the auto-healing algorithm.
As seen below, the test execution was successful. However, there is a small *bandage* icon (for indicating healed tests) next to the respective tests. This indicates that the tests are healed when potential failures are encountered during the course of test execution.
Navigate to the respective test in the [LambdaTest dashboard](https://automation.lambdatest.com/build) and click on the *Bandage* icon to view details of the test.
For further reference, please visit [Official Documentation of Auto Healing on LambdaTest](https://www.lambdatest.com/support/docs/auto-healing/)## Have feedback or need assistance?
Feel free to fork the repo and contribute to make it better! Email to [himanshu[dot]sheth[at]gmail[dot]com](mailto:himanshu.sheth@gmail.com) for any queries or ping me on the following social media sites:LinkedIn: [@hjsblogger](https://linkedin.com/in/hjsblogger)
Twitter: [@hjsblogger](https://www.twitter.com/hjsblogger)