Coder Social home page Coder Social logo

test-academy-selenium's Introduction

demo-Web-testing-with-Selenium

Project to test Serenity with Selenium and Cucumber

  • Demo project to know how to architecture a test project which has some complexity.
  • The project is following the Page Object pattern. Where a class express the interface of a page and nothing related to a test can be inside the class. So:
    • No webElement should be exposed from a page object.
    • No assert can be done inside a page object. So, be careful if you write a mehtod to verify anything in a page class, ie returns a boolean, that your are not coupled to a test.

Responsible

Sergio Sacristan [email protected]

Getting started

You can improve everything in the project with a PR:

  • You need to create a git branch, following the naming convention feature/whatever
  • Make a pull request!
  • Thank you in advance for your contribution!!!!

Requirements

Structure

Application mirror

  • src/main/java.../domain: DTO objects (for the data interface of every page)
  • src/main/java.../pages: Page objects

Application tests

  • src/test/resources/features: create a structure in order to have all the features of a page in the same folder.
  • src/test/java/,,,/builders: use the patter Builder and Data Builder in order to encapsulate the managemenet of the data needed for the tests.
  • src/test/java/,,,/domain: DTO to access the API of the AUT (application under test).
  • src/test/java/,,,/services: use the pattern Facade to encapsulate the initialization of the data scenario. This initialization should be done be calling the API services of the AUT or DB (using a DAO), but never initialize the data calling another pages of the AUT.
  • src/test/java/,,,/stepsdefs: create a StepDef per Feature, and follow the same package structure as the related feature
    • For commonn steps to different stepDef, but within the same folder, create a CommonStepDef
    • Use Serenity.getCurrentSession().put/get to share common data between related steps definitions classes
  • src/test/java/,,,/tests: here you have the classes to run the tests

Configuration

  • This is a gradle project, you can import it from your favorite IDE as Gradle project.
  • To verify that all is up to date with dependencies and test compilation, execute the gradle task: testClasses
    gradlew.bat testClasses
  • Before execute the tests, execute the gradle task: downloadChromeDriverServer

Compilation

Execution

gradle test -Dcucumber.options="--tags @something"

CI

$ zalenium/docker-compose up -d

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.