Giter VIP home page Giter VIP logo

java-selenium-webdriver-cucumber's Introduction

Sample project to use Selenium Webdriver tests with Cucumber and Java

This is a sample project to use Selenium Webdriver tests with Cucumber and Java.

Organization of the project

This repository is organized into different folders:
  • The Actions folder contains specific methods that perform actions related with different features.
  • The Factory folder contains all the information related with browsers and the drivers necessary for the project to run and interact with the browsers.
  • The PageObjects folder contains the web elements with their respective locators.
  • The StepDefinitions folder contains the steps of each cucumber specification linked to the implementation code.
  • The Utils folder contains the BaseClass that centralizes some generalized actions to interact with the browser.

Design Patterns used in this project and their explanation

Factory Pattern

Factory pattern create objects based on browser type and it is applied to this project through the DriverFactory class. The DriverFactory class has the method getDriver, that returns different drivers based on the DriverType enum, that holds different browser types. Test classes should not be worried about how the drivers used in tests are created. So, Factory Pattern hides from the other classes how drivers are being created. If is needed to change something about the drivers it only be changed in one place DriverFactory class.

Singleton Pattern

Singleton Pattern is used to have only one instance of the web driver in use across all the tests of the project and it is applied to this project through the DriverFactory class. The DriverFactory class has private constructor, a private static instance of the web driver with return type to check if class is already instantiated once.

Page Object Pattern

Page Object Pattern is used to improve test automation maintenance and reducing code duplication and it is applied to this project in page_objects folder. The classes inside page_objects folder represent the locators for web elements of each different page from the website used for tests and their separation from tests that are in resources folder.
The custom Page Object Pattern says that actions associate with features and with page objects should also be in this classes along with locators. Due to the violation of Single Reponsability Principle that states that classes can only have one reason to change, regarding the SOLID principles of object oriented programming language, in this project each group of actions associated with the features and with page objects, are in a new class in actions folder.

To Run

After clone this project and open with JetBrains Intellij is it needed to change the location of web drivers path that are specified in DriverFactory class to the path of drivers location and go to one of the cucumber features implemented and make run scenario.

java-selenium-webdriver-cucumber's People

Contributors

manuela-sousa avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.