Exploring test automation with Healenium

Softweb Solutions Inc
Softweb Solutions Inc.
3 min readMay 29, 2024

Test automation is a powerful tool, but brittle tests caused by UI updates can grind development to a halt. Healenium offers a revolutionary solution: self-healing test automation. This innovative framework leverages machine learning to automatically identify and fix broken locator values, dramatically improving test stability and reducing maintenance overhead. Healenium empowers you to focus on building high-quality software, not chasing down test failures.

90% of enterprises are projected to adopt automated testing tools by the end of 2024. — Gartner

In this blog, we will learn what Healenium is, how it works and its benefits.

How does Healenium work

Healenium makes test automation easier by working with tools like JUnit and TestNG, it improves Selenium’s abilities with its self-fixing feature. If a test script can’t find an element, Healenium steps in and looks for it by using an AI algorithm. It adjusts the script, so it keeps working even if the website changes. Healenium also creates helpful reports, showing what it did, helping testers check everything is working as it should.

Advantages of Healenium:

  • Integration with different projects using various frameworks into a single Healenium backend instance.
  • Support for parallelism, enabling the execution of test cases concurrently.
  • Remote execution capability.
  • Compatibility with iframes and JavaScript actions.
  • Selenide can be used for test implementation.
  • Support for mobile applications through Appium.

Configuring Docker with Healenium:

Configuring Docker with Healenium involves setting up the following services:

  • postgres-db: PostgreSQL database to store etalon selector/healing/report.
  • hlm-proxy: Proxy client requests to the Selenium server.
  • hlm-backend: CRUD service.
  • selector imitator: Converts healed locators to a convenient format.
  • selenoid/selenium-grid: Selenium server.

Healenium with Docker:
Docker provides a containerized environment for running Healenium alongside Selenium tests. Healenium provides pre-built Docker images containing all the necessary dependencies for running tests. We can utilize these images with Docker Compose, a tool for managing multi-container applications. Here is a configuration overview:

1. Docker Compose Configuration: We can create a docker-compose.yml file that defines the services required for your tests. This generally includes:

a) A container for your Selenium WebDriver (e.g., ChromeDriver)

b) A container for the Healenium server

2. Running the services: Once you’ve configured the docker-compose.yml file, use the command docker-compose up -d to start the containers in the background.

3. Test execution: Integrate your test scripts with Healenium by configuring the Healenium server URL and using the SelfHealingDriver class instead of the standard WebDriver class.

Healenium installation process and setup:

1) Add the following POM dependency:

<dependencies>

<dependency>

<groupId>io.healenium</groupId>

<artifactId>healenium-web</artifactId>

<version>2.0.0</version> <! — Use the latest version available →

</dependency>

</dependencies>

2) Clone the Docker repository:

git clone https://github.com/healenium/healenium.git

3) Include the Healanium.properties file, specifying parameters like recovery-tries, score-cap, heal-enabled, serverHost, serverPort, and imitatePort.

4) Run the Docker Compose command: docker-compose up -d

5) Example of remote driver launching

String nodeURL = “http://localhost:8085";

ChromeOptions options = new ChromeOptions();

options.addArguments(“ — no-sandbox”);

options.addArguments(“ — disable-dev-shm-usage”);

WebDriver driver = new RemoteWebDriver(new URL(nodeURL), options);

Healenium report in Docker

Typically, the reports are stored within the container running the Healenium server. You can access them using Docker volume mounts or by exporting the container’s file system.

Conclusion

In conclusion, Healenium is a game-changer for test automation. By incorporating machine learning for self-healing locators and offering a suite of robust testing tools, Healenium reduces maintenance overhead, improves test stability, and empowers testers to focus on strategic test automation initiatives. Contact our experts to know more.

--

--