Layer diagram
Directory structure
How the layers connect
Runner triggers Cucumber
TestRunner extends AbstractTestNGCucumberTests and carries the @CucumberOptions annotation. TestNG discovers it and delegates scenario execution to the Cucumber engine.Hooks manage the browser lifecycle
Before each scenario,
Hooks.setUp() creates a new ChromeDriver instance and stores it on TestContext. After each scenario, Hooks.tearDown() quits the browser and frees memory.Step definitions orchestrate the test
RiuSteps receives TestContext via PicoContainer constructor injection. Each Gherkin step maps to a method that creates a page object and delegates the action to it.Page objects drive the browser
RiuHome and LoginModal extend BasePage. They hold locators as private fields and expose intent-revealing methods (clickRegister(), typeName()) rather than raw Selenium calls.Major components
TestRunner
The Cucumber + TestNG entry point. Configures feature paths, glue packages, tag filters, and Allure reporting. Nothing else needs to change when adding new scenarios.
Hooks
Manages browser lifecycle with
@Before and @After annotations. Receives TestContext through PicoContainer so the same driver instance is shared without static fields.Page Objects
One class per page or modal. Locators are private; public methods describe user intent. Extend
BasePage to inherit all waiting and interaction helpers.BasePage
A thin, opinionated wrapper around Selenium 4. Provides
find, click, type, getText, isDisplayed, isClickable, isChecked, and navigateTo — all with built-in explicit waits.TestContext
A plain Java object that holds the
WebDriver instance. PicoContainer injects the same instance into every class that declares it as a constructor parameter.Feature Files
Gherkin scenarios written in Spanish that describe business behaviour. Tags (
@smoke) control which scenarios the runner picks up.Technology choices
| Technology | Role | Why |
|---|---|---|
| Selenium 4 | Browser automation | Native WebDriver BiDi support, relative locators, improved grid. |
| Cucumber 7 | BDD layer | Gherkin scenarios act as living documentation understood by non-technical stakeholders. |
| TestNG | Test runner | Parallel execution, flexible reporters, and native integration with AbstractTestNGCucumberTests. |
| PicoContainer | Dependency injection | Zero-configuration constructor injection keeps step classes stateless and easily composable. |
| Allure | Reporting | Rich HTML reports with step-level screenshots, timeline view, and CI integration. |
The framework currently targets Chrome via
ChromeDriver. Cross-browser support can be added by replacing the driver instantiation in Hooks.java with a factory that reads a system property.