How dpaktester/mi_bdd_flipkart_ex works
Project Type & Purpose
• This is a Selenium-based UI automation framework built in Java using Maven, Cucumber, TestNG and Extent Reports.
• Purpose: provide reusable helper methods (ElementUtil), implement the Page-Object Model, execute feature-based tests (Gherkin) and generate HTML/PDF test reports.
File Structure Analysis
• Top-level files
• pom.xml (Maven configuration)
• testng.xml (TestNG suite)
• README.md
• lib/*.jar (external utility JARs)
• src/main/java
• factory/DriverFactory.java – initializes WebDriver instances
• pages/*.java – Page Object classes (LoginPage etc.)
• utilities/*.java – ConfigReader, Constants, PasswordEncryption, ElementUtil
• src/test/java
• applicationhooks/AppHooks.java – lifecycle hooks (before/after scenarios)
• stepdefinitions/SmokeTestSteps.java – Cucumber step mappings
• testrunners/TestRunner.java – Cucumber + TestNG runner
• src/test/resources
• features/*.feature – Gherkin feature files
• config/config.properties – environment settings
• cucumber.properties, logback.xml, extent-config.xml, pdf-config.yaml
• Output folders
• CucumberExtent-Reports & test-output-thread – Spark & PDF/HTML reports
• test-output-thread/* – TestNG default HTML report
README Insights
• ElementUtil: Core reusable Selenium methods (click, waits, file upload/download, dropdowns, JS executor, window/frame handling, advanced interactions, etc.)
• Emphasis on simplifying web automation and providing a comprehensive toolkit for tests.
Diagramming the Architecture
a. Main Components
• Test Runner (TestNG + Cucumber)
• Gherkin Feature Files
• Step Definitions
• Application Hooks (before/after)
• Page Objects
• ElementUtil & Utility Classes
• DriverFactory (WebDriver manager)
• Browser Driver (ChromeDriver/GeckoDriver)
• External Config & Resource Files
• Report Generators (Spark, PDF, TestNG)
b. Relationships & Data Flow
1. TestRunner picks up *.feature files.
2. Cucumber engine parses scenarios and invokes StepDefinitions.
3. StepDefinitions call PageObjects + ElementUtil methods.
4. DriverFactory supplies WebDriver → communicates with Browser (Chrome/Firefox).
5. Utilities (ConfigReader, Constants) supply test data & timeouts.
6. Application Hooks manage setup/teardown (driver init, report start/end).
7. Reports are collected & written via Extent/Spark/PDF modules.
c. Architectural Patterns
• Page Object Model: separates page structure & actions into classes.
• Factory Pattern: DriverFactory abstracts browser initialization.
• Layered Design:
1. Presentation (Gherkin features)
2. Glue (StepDefinitions)
3. Domain (PageObjects & ElementUtil)
4. Infrastructure (DriverFactory, ConfigReader)
5. Reporting (Extent, PDF)
d. Key Technologies
• Java, Maven, TestNG, Cucumber
• Selenium WebDriver
• ExtentReports & Spark
• Logback, PDF generation (YAML config)
• ConfigReader (properties file)