Integrate Healenium Library Using Docker in Maven Project

Back to Blog
Feature image for Docker Maven Project

Integrate Healenium Library Using Docker in Maven Project

Automated testing with Selenium in Java faces challenges when locators of web elements change, leading to test script failures. These changes can occur due to updates in the application’s UI or underlying codebase.

Here in this blog, we introduce  Healenium which comes into the picture that can conquer these challenges.

What Is Healenium?

Healenium, an open-source automated testing library, enhances the stability of Selenium-based test suites by managing changes in web elements due to updates. Compatible with Selenium-supported languages like Java, Python, JavaScript, and C#.

It offers two approaches:
a) Healenium-Proxy
b) Healenium-Web

Image of Healenium Web Approach

In this blog, we are focusing on the Healenium-Web Approach.

Prerequisites

  1. Must have Docker’s Latest version installed.
  2. Download or clone the latest Healenium repository.
  3. Must have Maven Java Selenium framework

Steps:

1. Add maven dependency in the pom.xml file in your project

<dependency>
    <groupId>com.epam.healenium</groupId>
    <artifactId>healenium-web</artifactId>
    <version>3.4.8</version>
</dependency>

2. Init driver instance of SelfHealingDriver

 		//declare delegate
        WebDriver delegate = new ChromeDriver();
//create Self-healing driver
SelfHealingDriver driver = SelfHealingDriver.create(delegate);

3. Create a healenium.properties file in the resources folder in your project and fill it with the following properties:

recovery-tries = 1
score-cap = .6
heal-enabled = true
hlm.server.url = http://localhost:7878
hlm.imitator.url = http://localhost:8000

4. Add docker-compose and docker-compose-web yaml files from the downloaded healenium folder to your project folder and run the following command to up and run docker services:

docker-compose -f docker-compose-web.yaml up -d

5. Navigate to http://<hlm-backend-address>/healenium/report to check healenium backend is running.

Local: http://localhost:7878/healenium/report

6. Now Run your automated test cases using Maven

mvn test

7. After completion of your test execution, check the self-healing report

http://localhost:7878/healenium/report

If the locator has been modified, your report will resemble the example shown in the screenshot below.

Image of Self Healing Automation

Conclusion:

Using Healenium, the QA Team can mitigate the impact of locator changes and maintain the reliability of their test suites. Integrating Healenium with Docker further streamlines the execution of Java-based web automation tests, offering a robust solution for continuous testing within containerized environments.


Related Post:-

Share this post

Back to Blog