An open API service indexing awesome lists of open source software.

https://github.com/alisson-t-bucchi/cc360-selenium-cucumber-java

BDD in a Page Object project of Full Search Automation Test on the Search 360 Page with Cucumber.
https://github.com/alisson-t-bucchi/cc360-selenium-cucumber-java

bdd-tests cucumber-java e2e-tests gherkin java junit4 personal-project pom selenium-webdriver

Last synced: 6 months ago
JSON representation

BDD in a Page Object project of Full Search Automation Test on the Search 360 Page with Cucumber.

Awesome Lists containing this project

README

          

# BDD in a Page Object project of Full Search Automation Test on the Search 360 Page with Cucumber.
This project uses **Cucumber**, **Selenium Webdriver**, and **Java** to automate the process of searching for information on the Search 360 page a onmichannel plataform by Cisco.
The tests was organized with **JUnit 4** and interact with a web application to ensure the functionality of various forms and dropdowns.
This project has POM.XML configuration to produce detailed error reports with **Surefire Reports** and insert in **DevOps methodology to be integrated in CD/CI pipeline** with **Jenkins** and **Docker**.

## Description
The goal of this project is to perform a complete search for information on the Search 360 page, covering data entry and interaction with various elements of the page interface, such as text fields, dropdown lists, and buttons.

## Test Functionality
The automated test performs a sequence of actions as described in the Feature File of Cucumber. The flow includes:
1. Opening the Search 360 page.
2. Filling in reference, agent, email, and phone fields.
3. Interacting with various page elements, such as service line, category, subcategory, reason, state, and period.
4. Performing a search using the Search button.
5. Interacting with additional elements such as Voice, Email, and Chat.
6. Closing the page after the process is complete.

## Prerequisites
Before running the tests, ensure you have the following installed:

- **JDK 11 or higher**: Required for compiling and running Java code.
- **Maven** or **Gradle**: To manage dependencies (choose one based on your preference).
- **Selenium WebDriver**: To perform browser automation.
- **WebDriverManager**: To automatically manage browser drivers.
- **JUnit 4**: Testing framework used to organize and execute tests.
- **ChromeDriver**: The WebDriver used for testing with Google Chrome.

## Dependencies

You can use **Maven** or **Gradle** to manage the dependencies.

### Maven (`pom.xml`):

```xml


org.seleniumhq.selenium
selenium-java
4.0.0


io.github.bonigarcia
webdrivermanager
5.2.0


org.junit.jupiter
junit-jupiter-api
5.7.2
test


org.junit.jupiter
junit-jupiter-engine
5.7.2
test


commons-io
commons-io
2.8.0

```

## How to Run the Project
1. Clone the repository:
git clone https://github.com/your-username/cucumber-automation.git
cd cucumber-automation

2. Set up your environment:
If you don’t have Maven or Java set up yet, follow these instructions:
Maven: Official Maven Documentation
Java: Official Java Documentation

3. Install dependencies: Run the following command to install the dependencies defined in the pom.xml file:
mvn clean install

4. Run the tests: After installing the dependencies, run the tests with the command:
mvn test

5. Results: The test results will be displayed in the terminal, and you can also check the execution report generated by Maven if you’ve set up a reporting plugin like Cucumber Reporting or Allure.

6. Project Structure
The project is organized as follows:

```
CC360-selenium-cucumber-java/
src
|── main
| └── java
| └── pages # Page Object localization
| ├── Search360Page.java # Include reusable methods for system searches iterations
| └── steps
| ├── BaseTest.java # Manage WebDriver lifecicle
| ├── DemoCC360AutomationCucumber.java # Features steps described in .feature file
|── test
| └── resources # Gherkin scenarios tests
| ├── features
| ├── search360.feature
| └── config
| ├── cucumber.properties
|
├── pom.xml # Maven configuration file
└── README.md # This file
```

7. Execution Flow:
- Feature File (.feature):
Describes the test scenarios in Gherkin, as shown in the example above.

- Step Definitions (DemoCC360AutomationCucumber.java):
Implements the steps described in the .feature file using the actions defined in the Page Object.

- Page Object (Search360Page.java):
Encapsulates the selectors and interaction methods for the page being tested.

- Driver Management (BaseTest.java):
Configures and terminates the WebDriver.

## Important Files
- pom.xml: Manages Maven dependencies and plugins.
- search360.feature: The Gherkin file describing the feature and test scenarios.
- DemoCC360AutomationCucumber.java: Defines the steps for Cucumber (BDD).
- Search360Page.java: Contains the logic for interacting with the page interface.

## Example .feature File
The search360.feature file contains the test scenario for the full search on the Search 360 page:

```
Feature: Perform a full search on the Search 360 page

Scenario Outline: Perform a full search on the Search 360 page
Given open the page
When I enter "", "", "", and ""
And click on Service Line and select option
And click on Category and select option
And click on Sub-category and select option
And click on Reason and select option
And click on State and select option
And select a period
And click on Search
And click on Voice and close
And click on Email and close
And click on Chat and close
Then close the page

Examples:
| referencia | agente | email | telefone |
| "referencia" | "agente" | "email" | "telefone" |

```

## DemoCC360AutomationCucumber.java File
The Cucumber step definitions file (DemoCC360AutomationCucumber.java) implements the logic for each of the steps defined in the .feature file.

### Additional Information

- WebDriver: The tests are configured to use Google Chrome. To use another browser (e.g., Firefox), modify the driver = new ChromeDrive (); line in the code.

- WebDriverManager: Automatically manages the browser driver, ensuring compatibility between the Selenium version and the browser's driver.

- JUnit: Tests are organized using JUnit 4, and execution order is based on method names (due to the @FixMethodOrder(MethodSorters.NAME_ASCENDING) annotation).

## Contribution
If you would like to contribute to the project, follow these steps:
1. Fork this repository.
2. Create a branch for your modifications (git checkout -b feature/new-feature).
3. Make the necessary changes.
4. Submit a pull request.

## License
This project is licensed under the MIT License.