Skip to content

Latest commit

 

History

History
139 lines (103 loc) · 4.05 KB

File metadata and controls

139 lines (103 loc) · 4.05 KB

Wikipedia Selenium Java Automation Project

This project is prepared for the Wikipedia Search Page Testing.

Tool stack

  • Java
  • Selenium
  • Cucumber
  • Junit
  • Docker (Docker compose for Selenium GRID 4)

Requirements

Project Tree

.
├── LICENSE
├── README.md
├── config
│   └── baseConfig.properties
├── docker-compose.yml
├── pom.xml
└── src
    └── test
        ├── java
        │   └── com
        │       └── wikipedia
        │           ├── pages
        │           │   ├── BasePage.java
        │           │   ├── HomePage.java
        │           │   ├── SearchPage.java
        │           │   └── SearchResultsPage.java
        │           ├── runners
        │           │   └── CucumberTestRunner.java
        │           ├── step_def
        │           │   ├── HomePageStepDef.java
        │           │   ├── Hooks.java
        │           │   ├── SearchPageStepDef.java
        │           │   └── SearchResultsPageStepDef.java
        │           └── utilities
        │               ├── ConfReader.java
        │               ├── Driver.java
        │               └── Utils.java
        └── resources
            ├── cucumber.properties
            └── features
                └── search.feature

config Folder

Used for environment variables. There are usually .properties files.

Pages Folder

This will be used for Page Object Model implementation in the project. Locators should be defined at the top of the page. The locator definition should not be made inside the methods. Actions of all steps are defined on pages.

Runner Folder

The cucumber execution configuration is done in this folder.

Step definitions folder

This folder will be the place where the step definitions of the scenarios are made. Code should not be written in steps files. Functions must be called from the corresponding Page class. In the Hooks class, the actions to be taken before and after each scenario is run are defined. (Driver stand-up, screenshots)

Features folder

Feature files, that is, test cases in Gherkin format will be located under this folder.

Utils Folder

The utils class and methods of the project will be defined in this folder.

pom.xml

The file required for the installation of project necessary libraries and their plugins.

target/cucumber-html-reports

Generates cucumber html reports after each execution.

Naming Convention

Conditions are requested when naming. Names should be short and meaningful.

directory names = my-directory (lower camel case)

variable name = myVariable (lower camel case)

method name = myMethod (lower camel case)

class name = MyClass (Upper camel case)

WebElement myElement (lower camel case)

Feature name = MyFeature (Upper camel case)

folder name = my-folder

tag name = @myTag

Test Run

Maven CLI command to run tests.

execution tests via Tag :

mvn test -Dcucumber.filter.tags="@regression"

execution tests via Cucumber options

mvn test -Dcucumber.options="--tags @smoke"

execution tests via Feature

mvn test -Dcucumber.options="src/test/resources/features/search.feature" -Dcucumber.filter.tags="@regression"

execution tests via docker

create docker container docker compose up -d --build

switch the browser type is remote-chrome or remote-firefox on baseConfig.properties

execution tests via Tag : mvn test -Dcucumber.options="--tags @smoke"