🔹 1. What is Healenium? / Healenium भनेको के हो?
Healenium एउटा open-source AI-based tool हो जुन Selenium WebDriver सँग integrate गरेर flaky test cases लाई automatically recover गर्छ।
👉 यो tool ले browser testing मा failure आउने locator हरूलाई self-heal गर्ने काम गर्छ – जसले गर्दा तपाईंले बारम्बार XPath/CSS update गर्नुपर्ने समस्या हट्छ।
🔸 In short, Healenium helps testers handle changing UI elements in automation without breaking their test scripts.
🎯 Key Concept:
- When your automation test fails due to broken locators, Healenium will try to find the correct element using historical data and DOM similarity — अनि test लाई पास गराउँछ।
Example Use Case:
java
CopyEdit
@BeforeMethod
public void setUp() {
WebDriver driver = new HealingDriver(chromeDriver);
}
यो example मा HealingDriver ले normal WebDriver को काम inherit गरेर self-healing logic use गर्छ।
🔹 2. Why Use Healenium? / किन Healenium प्रयोग गर्ने?
Automation testing मा सबैभन्दा common समस्या हो flaky test cases — जुन समय-समयमा fail हुन्छन् even though the functionality is correct.
Healenium ले यी problem लाई smart तरीकाले समाधान गर्छ।
✅ प्रमुख कारणहरू (Top Reasons to Use Healenium)
1. 🔧 Self-Healing Locators
👉 तपाईंको XPath या CSS selector परिवर्तन भए पनि Healenium ले पुरानो DOM structure को आधारमा सही element पहिचान गर्छ र test pass गराउँछ।
2. 🧠 AI-Powered Healing
👉 Healenium ले test run को क्रममा browser को DOM structure compare गरेर machine learning प्रयोग गर्छ।
3. ⏱️ Time Saving
👉 Manual locator fixing गर्नुपर्ने समय बचत हुन्छ। Tester ले बारम्बार code update गर्नु पर्दैन।
4. 🧪 Increased Test Reliability
👉 Flaky tests हटाएर continuous integration (CI) मा confident test results पाउन सकिन्छ।
5. 📈 Better Test Maintenance
👉 Large-scale UI testing framework हरू maintain गर्न सजिलो हुन्छ — especially जब page structure frequently बदलिन्छ।
🔍 Real-world Scenario:
🚫 Without Healenium:
java
CopyEdit
driver.findElement(By.xpath(“//button[@id=’submit’]”)).click(); // Fails if ID changes
✅ With Healenium:
java
CopyEdit
WebDriver driver = new HealingDriver(chromeDriver);
driver.findElement(By.xpath(“//button[@id=’submit’]”)).click(); // Auto-heals even if locator changes
Healenium ले fallback mechanism प्रयोग गरेर पुराना र नयाँ structure compare गर्छ र best-matching element find गर्छ।
🔹 3. How Healenium Works / Healenium कसरी काम गर्छ?
Healenium ले Selenium WebDriver को साथ integrate भएर test run को समय DOM structure monitor गर्छ। जब कुनै locator fail हुन्छ, तब यसले AI-based fallback mechanism प्रयोग गरेर element locate गर्छ।
🧭 Step-by-Step Workflow (Healenium कार्य प्रक्रिया)
🥇 Step 1: Test Execution Starts
- Normal Selenium command जस्तै findElement() execute हुन्छ।
- Example:
java
CopyEdit
driver.findElement(By.xpath(“//input[@id=’username’]”));
🥈 Step 2: Locator Failure Detection
- यदि XPath/CSS locator browser मा भेटिएन भने → Healenium triggers healing mode.
🥉 Step 3: Historical Snapshot Comparison
- Healenium ले पहिले cache गरिएको DOM snapshot use गर्छ।
- पुरानो र हालको DOM structure लाई compare गर्छ।
🏅 Step 4: Best Match Locator खोज्ने
- AI algorithm प्रयोग गरेर similar element खोजिन्छ (attribute, position, tag, etc.)।
🎯 Step 5: Test Continues with Healed Locator
- Healenium ले auto-correct गरिएको locator बाट action retry गर्छ।
- Test case fail नहुँने तरिकाले run हुन्छ।
🔄 Visual Flow (English Summary)
plaintext
CopyEdit
Test Starts
↓
Locator Breaks?
↓ Yes
Healenium Checks DOM Snapshot
↓
Finds Best-Match Element
↓
Executes Test → Passes with Healed Locator
🔍 Bonus: What You Need to Use Healenium
- ✅ Java + Selenium WebDriver
- ✅ Maven Dependency:
xml
CopyEdit
<dependency>
<groupId>com.epam.healenium</groupId>
<artifactId>healenium-web</artifactId>
<version>3.3.1</version>
</dependency>
- ✅ Replace WebDriver with HealingDriver in your test setup.
🔹 4. Installation & Setup Guide / Healenium Installation र Setup कसरी गर्ने?
Healenium लाई Selenium Java framework मा integrate गर्न सजिलो छ। यहाँ step-by-step प्रक्रिया दिइएको छ जसले तपाईंलाई सुरु गर्न मद्दत गर्छ।
🧱 Prerequisites / आवश्यक तयारीहरू
- ✅ Java 8+ installed
- ✅ Maven project structure
- ✅ Selenium WebDriver integrated
- ✅ ChromeDriver or compatible browser driver
🛠 Step-by-Step Installation Process
✅ Step 1: Add Healenium Dependency to pom.xml
xml
CopyEdit
<dependency>
<groupId>com.epam.healenium</groupId>
<artifactId>healenium-web</artifactId>
<version>3.3.1</version>
</dependency>
✅ Step 2: Add Selenium Dependency (if not already added)
xml
CopyEdit
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.17.0</version>
</dependency>
✅ Step 3: Update Your WebDriver Setup
👉 Replace WebDriver with HealingDriver:
java
CopyEdit
import com.epam.healenium.SelfHealingDriver;
import org.openqa.selenium.chrome.ChromeDriver;
WebDriver original = new ChromeDriver();
SelfHealingDriver driver = SelfHealingDriver.create(original);
अब तपाईंले driver.findElement() प्रयोग गर्दा Healenium ले broken locators लाई auto-recover गर्छ।
📂 Optional: Setup for Healenium Backend (Advanced)
If you want to view healing history and snapshots:
- Run the Healenium Backend via Docker:
bash
CopyEdit
docker-compose -f docker-compose.yml up
- This will start:
- Healenium service
- MongoDB
- UI Dashboard (usually on http://localhost:7878)
🧪 Ready to Run Test Example
java
CopyEdit
driver.findElement(By.xpath(“//input[@id=’email’]”)).sendKeys(“lok@example.com”);
XPath break भए पनि Healenium ले यो element locate गरेर script run जारी राख्छ।
🔹 5. Healenium vs Without Healenium (Comparison Table)
Healenium प्रयोग गर्नु अघि र पछिको अन्तर – यो तालिका (table) ले self-healing feature को practical प्रभाव देखाउँछ।
📊 Comparison Table (Nepali-English Mix)
Feature/Scenario | Without Healenium ❌ | With Healenium ✅ |
Locator break हुँदा test behavior | Test fails immediately | Test retries with healed locator |
Manual XPath update required? | हरेक UI change पछि update गर्नुपर्छ | Healenium ले auto-locate गर्छ |
Test stability in CI/CD | Flaky & unpredictable | Reliable & consistent |
Maintenance time | धेरै समय लाग्ने | धेरै बचत हुने |
Suitable for dynamic UIs | No | Yes |
Error message visibility | Stacktrace only | Healing info + fallback locator log |
Learning curve | Easy (Selenium knowledge only) | Moderate (extra setup + agent config) |
Backend healing dashboard | छैन | छ (with Docker setup) |
Ideal for large-scale test frameworks | ❌ Manual effort grows with scale | ✅ Easily scalable with locator cache |
Example locator | “//button[@id=’submit’]” fails | Healenium finds similar button element |
🧠 Summary (नेपालीमा संक्षेप):
Healenium ले flaky locator हरूको समस्या हल गरेर test framework लाई smart बनाउँछ। Selenium मात्र प्रयोग गर्दा जुन locator change भयो भने test फेल हुन्छ, तर Healenium ले त्यो locator को आधारमा similar element खोजेर test run जारी राख्दिन्छ।
🔹 6. Real-World Example (with GitHub Link)
प्रयोगमा आधारित उदाहरण (Selenium + Healenium Java Project)
🧪 Use Case: Login Page Test with Broken XPath
🔸 Scenario:
You have a login test that uses this XPath:
java
CopyEdit
driver.findElement(By.xpath(“//input[@id=’username’]”)).sendKeys(“lok123”);
- अब यदि frontend developer ले id=”username” लाई id=”user_id” मा change गर्यो भने:
- 🔻 Without Healenium → Test fails with NoSuchElementException.
- ✅ With Healenium → Automatically finds similar input field and test passes.
📂 GitHub Example Project Structure:
plaintext
CopyEdit
/selenium-healenium-demo
│
├── src/test/java/
│ ├── tests/
│ │ └── LoginTest.java
│ ├── base/
│ │ └── BaseTest.java
│
├── pom.xml
├── docker-compose.yml (for backend UI)
└── README.md
🔗 🔍 Sample Project GitHub Link
You can fork or clone this repo to start testing:
bash
CopyEdit
git clone https://github.com/healenium/healenium-web.git
Note: Use Docker to enable healing dashboard and logs:
bash
CopyEdit
docker-compose up -d
🔹 7. Healenium FAQs for Testers (Frequently Asked Questions)
❓ Healenium कुन test framework सँग काम गर्छ?
✅ Selenium Java (with JUnit/TestNG)
❓ Healenium Python वा JavaScript सँग काम गर्छ?
❌ हालको version केवल Java + Selenium projects सँग compatible छ।
❓ WebDriverManager प्रयोग गर्न सकिन्छ?
✅ हो, ChromeDriver वा FirefoxDriver manage गर्न WebDriverManager प्रयोग गर्न सकिन्छ।
❓ के Healenium ले REST API testing मा काम गर्छ?
❌ होइन, Healenium केवल UI (DOM-based) locator issues को लागि हो, API testing मा use हुँदैन।
❓ क्या CI/CD pipeline मा integrate गर्न सकिन्छ?
✅ हो, Jenkins, GitHub Actions, GitLab CI जस्ता tools सँग सहजै integrate गर्न सकिन्छ।
❓ क्या backend dashboard अनिवार्य हो?
❌ आवश्यक छैन, तर optional dashboard ले healing history हेर्न सजिलो बनाउँछ।