How rahulgarg01/healx works
Project Type and Purpose
• This is a Java-based open-source test automation framework/library (HealX) that enhances Selenium WebDriver with self-healing capabilities.
• Purpose: wrap Selenium calls, detect broken locators at runtime, and recover them via database-backed heuristics so tests remain robust against UI changes.
a. Test Suite (Your automated tests)
b. Selenium WebDriver (e.g., ChromeDriver)
c. CustomWebDriver & FirstRunDriver (wrapper/adapters around Selenium)
d. HealX Engine (healing logic)
• NormalRun (attribute/combination-based recovery)
• FirstRun (initial capture of locator data)
• Details utility (reflection-based locator name resolution)
e. RemoteDB (MongoDB or configured store)
f. Database (MongoDB instance)
1. Test Suite → (initialize) → CustomWebDriver or FirstRunDriver
2. CustomWebDriver.findElement(...) → underlying Selenium WebDriver
3. On NoSuchElementException:
→ CustomWebDriver catches exception
→ invokes HealX Engine (NormalRun)
→ NormalRun queries RemoteDB for stored element attributes
→ RemoteDB → MongoDB (read/write)
→ HealX Engine tries alternate locator strategies
→ CustomWebDriver retries findElement with healed locator
4. FirstRunDriver (on first execution) intercepts findElement:
→ captures attributes & position (via FirstRun)
→ writes locator data to RemoteDB → MongoDB
5. Details utility is invoked by both NormalRun and FirstRun to map exception to locator name.
Architectural Patterns & Principles
• Adapter/Decorator: CustomWebDriver and FirstRunDriver wrap Selenium WebDriver to extend behavior without modifying client code.
• Strategy Pattern: HealX applies different healing strategies in sequence (attribute-based, combination-based, position-based).
• DAO/Repository: RemoteDB abstracts MongoDB interactions for persisting locator metadata.
• Single Responsibility: each class (Details, HealX, FirstRun, NormalRun) has a clear focus in the healing pipeline.
Technologies & Frameworks
• Java 8+, Maven for build management
• Selenium WebDriver
• MongoDB (or any configured RemoteDB)
• Reflection API (in Details)
• JUnit/TestNG (implied by src/test)