selenium-java-test-automation-architecture icon indicating copy to clipboard operation
selenium-java-test-automation-architecture copied to clipboard

Ready-to-use UI Test Automation Architecture using Java and Selenium WebDriver.

Selenium Test Automation Boilerplate

Ready-to-use UI Test Automation Architecture using Java and Selenium WebDriver.

Languages and Frameworks

The project uses the following:

Project Structure

selenium-test-automation-boilerplate/
├─ .github/
│  ├─ workflows/
│  │  ├─ test-execution.yml
├─ gradle/
│  ├─ wrapper/
│  │  ├─ gradle-wrapper.jar
│  │  ├─ gradle-wrapper.properties
├─ report/
│  ├─ screenshot/
├─ script/
│  ├─ install_chrome.sh
├─ src/
│  ├─ main/
│  │  ├─ java/
│  │  │  ├─ io/
│  │  │  │  ├─ github/
│  │  │  │  │  ├─ tahanima/
│  │  │  │  │  │  ├─ config/
│  │  │  │  │  │  │  ├─ Configuration.java
│  │  │  │  │  │  │  ├─ ConfigurationManager.java
│  │  │  │  │  │  │  ├─ package-info.java
│  │  │  │  │  │  ├─ data/
│  │  │  │  │  │  │  ├─ login/
│  │  │  │  │  │  │  │  ├─ LoginData.java
│  │  │  │  │  │  │  ├─ BaseData.java
│  │  │  │  │  │  │  ├─ package-info.java
│  │  │  │  │  │  ├─ driver/
│  │  │  │  │  │  │  ├─ BrowserFactory.java
│  │  │  │  │  │  │  ├─ DriverManager.java
│  │  │  │  │  │  │  ├─ package-info.java
│  │  │  │  │  │  ├─ page/
│  │  │  │  │  │  │  ├─ login/
│  │  │  │  │  │  │  │  ├─ LoginPage.java
│  │  │  │  │  │  │  ├─ product/
│  │  │  │  │  │  │  │  ├─ ProductsPage.java
│  │  │  │  │  │  │  ├─ BasePage.java
│  │  │  │  │  │  │  ├─ BasePageFactory.java
│  │  │  │  │  │  │  ├─ package-info.java.java
│  │  │  │  │  │  ├─ report/
│  │  │  │  │  │  │  ├─ ReportManager.java
│  │  │  │  │  │  │  ├─ package-info.java
│  │  ├─ resources/
│  │  │  ├─ general.properties
│  ├─ test/
│  │  ├─ java/
│  │  │  ├─ io/
│  │  │  │  ├─ github/
│  │  │  │  │  ├─ tahanima/
│  │  │  │  │  │  ├─ login/
│  │  │  │  │  │  │  ├─ LoginTest.java
│  │  │  │  │  │  ├─ util/
│  │  │  │  │  │  │  ├─ DataProviderUtil.java
│  │  │  │  │  │  ├─ BaseTest.java
│  │  │  │  │  │  ├─ TestListener.java
│  │  ├─ resources/
│  │  │  ├─ testData/
│  │  │  │  ├─ login/
│  │  │  │  │  ├─ login.csv
├─ .gitignore
├─ build.gradle
├─ gradlew
├─ gradlew.bat
├─ README.md
├─ settings.gradle

Project Architecture

  • Config
  • Data
  • Driver
  • Page
  • Report
  • Test
  • Workflow

Config

The project uses general.properties file to map all the global parameters such as browser and base url. All the relevant classes to read the parameters are provided in the config package.

Data

The project reads test data from csv files. The test data properties are modeled in terms of entities and the data package handles this. For convenience, there is an example class - LoginData.java to demonstrate the usage.

Driver

The project uses Selenium WebDriver to automate user workflows for web-based applications as part of automated testing. The driver package contains all the necessary initialization logic for WebDriver.

Page

The project uses Page Object Model to capture all the relevant UI components and functionalities of a web page. The page package provides all the classes to achieve this. For convenience, there is an example class - LoginPage.java to demonstrate the usage.

Report

The project uses Extent Reports to provide test reporting functionalities. The report package contains the relevant class.

Test

LoginTest.java demonstrates an example test script.

Workflow

The project uses GitHub Actions to run the selenium tests when an update is made to the main branch of the repo in GitHub.