Ready-to-use UI Test Automation Architecture using Java and Selenium WebDriver.
In order to use the framework:
- Fork the repository.
- 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
- Import the project in IntelliJ IDEA.
- Make your desired changes.
- 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.
The project uses the following:
- Java 11 as the programming language.
- Selenium WebDriver as the web browser automation framework using the Java binding.
- WebDriverManager as the browser driver management library.
- Univocity Parsers to parse and handle CSV files.
- TestNG as the testing framework.
- AssertJ as the assertion library.
- Lombok to generate getters.
- Owner to minimize the code to handle properties file.
- Extent Reports as the test reporting strategy.
- Selenium Shutterbug for capturing screenshots.
- Gradle as the Java build tool.
- IntelliJ IDEA as the IDE.
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
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.
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.
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.
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.
The project uses Extent Reports to provide test reporting functionalities. The report package contains the relevant class.
LoginTest.java demonstrates an example test script.
The project uses GitHub Actions to run the selenium tests when an update is made to the main
branch of the repo in GitHub.