Skip to content

goob760/selenium-test-automation-boilerplate

 
 

Repository files navigation

Selenium Test Automation Boilerplate

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

Installation Steps

In order to use the framework:

  1. Fork the repository.
  2. Clone, i.e, download your copy of the repository to your local machine using
git clone https://github.com/[your_username]/selenium-test-automation-boilerplate.git
  1. Import the project in IntelliJ IDEA.
  2. Make your desired changes.
  3. Use IntelliJ IDEA to run your desired tests. Alternatively, you can use the terminal to run the tests, for example ./gradlew test -Dbrowser=firefox -Dheadless=false to run all the tests using the firefox browser in headed mode.

Languages and Frameworks

The project uses the following:

Project Structure

The project is structured as follows:

πŸ“¦ selenium-test-automation-boilerplate
β”œβ”€ .github
β”‚  β””─ workflows
β”‚     β””─ test-execution.yml
β”œβ”€ .gitignore
β”œβ”€ README.md
β”œβ”€ build.gradle
β”œβ”€ gradle
β”‚  β””─ wrapper
β”‚     β”œβ”€ gradle-wrapper.jar
β”‚     β””─ gradle-wrapper.properties
β”œβ”€ gradlew
β”œβ”€ gradlew.bat
β”œβ”€ script
β”‚  β””─ install_chrome.sh
β”œβ”€ settings.gradle
└─ src
   β”œβ”€ main
   β”‚  β”œβ”€ java
   β”‚  β”‚  β””─ io
   β”‚  β”‚     β””─ github
   β”‚  β”‚        β””─ tahanima
   β”‚  β”‚           β”œβ”€ config
   β”‚  β”‚           β”‚  β”œβ”€ Configuration.java
   β”‚  β”‚           β”‚  β”œβ”€ ConfigurationManager.java
   β”‚  β”‚           β”‚  β””─ package-info.java
   β”‚  β”‚           β”œβ”€ data
   β”‚  β”‚           β”‚  β”œβ”€ BaseData.java
   β”‚  β”‚           β”‚  β”œβ”€ login
   β”‚  β”‚           β”‚  β”‚  β””─ LoginData.java
   β”‚  β”‚           β”‚  β””─ package-info.java
   β”‚  β”‚           β”œβ”€ driver
   β”‚  β”‚           β”‚  β”œβ”€ BrowserFactory.java
   β”‚  β”‚           β”‚  β”œβ”€ DriverManager.java
   β”‚  β”‚           β”‚  β””─ package-info.java
   β”‚  β”‚           β”œβ”€ page
   β”‚  β”‚           β”‚  β”œβ”€ BasePage.java
   β”‚  β”‚           β”‚  β”œβ”€ BasePageFactory.java
   β”‚  β”‚           β”‚  β”œβ”€ login
   β”‚  β”‚           β”‚  β”‚  β””─ LoginPage.java
   β”‚  β”‚           β”‚  β”œβ”€ package-info.java
   β”‚  β”‚           β”‚  β””─ product
   β”‚  β”‚           β”‚     β””─ ProductsPage.java
   β”‚  β”‚           β””─ report
   β”‚  β”‚              β”œβ”€ ExtentReportManager.java
   β”‚  β”‚              β””─ package-info.java
   β”‚  β””─ resources
   β”‚     β””─ general.properties
   β””─ test
      β”œβ”€ java
      β”‚  β””─ io
      β”‚     β””─ github
      β”‚        β””─ tahanima
      β”‚           β”œβ”€ BaseTest.java
      β”‚           β”œβ”€ login
      β”‚           β”‚  β””─ LoginTest.java
      β”‚           β””─ util
      β”‚              β”œβ”€ DataProviderUtil.java
      β”‚              β””─ TestListener.java
      β””─ resources
         β””─ testData
            β””─ login
               β””─ login.csv

Project Components

Config

The project has some global properties, for example, browser and base url. The config package holds all the relevant classes to handle these global properties.

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.

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.3%
  • Shell 0.7%