Java Web Test Automation
Description
I use this repository as a base for a web test automation project or just as a part of my programming portfolio.
It consists of 2 modules with the same tests but different test automation frameworks: Selenium and Selenide.
Selenide module
Usually, you want a framework witch provides concise fluent API for tests and Selenide is one of the available choices.
Tools
- Selenide — browser automation
- JUnit5 — Java testing framework
- Allure — test reporting tool
- Selenoid* — Docker browser farm
*First you need to install Selenoid. To use it, replace default Selenide WebDriver with your own Remote WebDriver.
Test Design Pattern
Page Object with the addition of Sections (a.k.a. Fragments or Widgets).
Test reporting
To generate and show the Allure report:
mvn clean test -pl selenide
mvn allure:serve
http://localhost:8080
will be automatically opened in the browser
Lint checks
Some basic Checkstyle checks adapted for UI testing (checkstyle.xml
).
To run: mvn checkstyle:checkstyle
Selenium module
Nowadays I don't expect to work directly with Selenium, but it's important to have experience with it since the majority of test frameworks are based on Selenium.
Tools
- Selenium — browser automation
- JUnit5 — Java testing framework
- AssertJ — a rich set of assertions
- WebDriverManager — automatic management of Selenium WebDriver binaries
Test Design Pattern
Fluent Page Object, described in Selenium Wiki, with the addition of Sections (a.k.a. Fragments or Widgets).
This version of Page Object requires every step to return some page, so we can chain all the steps.
I don't prefer this version because in the test it makes it hard to track where we currently are on the website since all transitions between pages end up being hidden in the method chaining.
It also becomes hard to maintain when you want to implement reusable Sections instead of just vanilla Page Objects. In this project, I've used generics to map Section to an appropriate Page.