Giter Site home page Giter Site logo

agusilveira / selenium_bdd_framework Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shankybnl/selenium_bdd_framework

0.0 0.0 0.0 28.51 MB

Behavioural driven development UI automation framework using selenium, cucumber-java, testng, maven, phantomjs

Java 100.00%

selenium_bdd_framework's Introduction

selenium_BDD_framework

Behavioural driven development automation framework using selenium, cucumber-java, testng, maven, phantomjs

Tools and technologies used:

  1. Language: Java 8
  2. Testing framework: Testng
  3. BDD framework: Cucumber jvm
  4. Automation tool: Selenium webdriver
  5. Build tool: maven
  6. Logging: log4j
  7. Headless browser: Phantomjs
  8. Reporting: cucumber reporting

Features of the framework

  1. BDD framework using Cucumber-jvm. Feature files can be written easily using Given,When, Then etc.
  2. Browser(chrome/firefox) can be configured at run time from command line (or Continuous integration tool, if configured).
  3. Tests can run in headless browser (Phantomjs) by passing a parameter at run time.
  4. Screenshot would be taken if any scenario failed and saved under /outputFiles folder.
  5. Html report gets generated after each test run and can be found /target/cucumber-html-report/index.html

package: libs : It has exe of chromedriver and phantomjs. This is required while creating the webdriver session.

image

package: features : It contains all different features (tests) files.

image

package: framework : It includes the common classes (and methods) which are required by each test to perform actions. Below are classes in this package:

image

Assertions.java : It contains assertion methods like verifyEquals,screenshot etc. These can be used in any of the helper files to verify the actual result with expected result.

CommonMethods.java : It is a common repository for all the webdriver methods which are used in every class present under logic package to perform actions like click, findElement etc. Every new method which is being used in logic classes should be added in this class as well. It is to reduce the duplicate code. Each page class extends this class.

CreateSession.java : All the methods to create a new session and destroy the session after the test(s) execution is over.

TestRunner.java : Features/tests to be executed are defined in this class. Other test configurations are also defined here.

package: logger : It contains Log.java class which contains methods to show the logs on console and save the logs in LogFile.txt of each run.

image

package: logic : contains all the classes where actions and assertions happens.

image

pakage: outputFiles : All the output files will be stored here (screenshots/csv/txt files)

image

package: pages : It has web elements corresponding to the specific page which is used by corressponding logic classes.

image

Test report

Once test execution is completed, go to target/cucumber-report folder and open feature-overview.html file

image

You can see the test results at different level

image

Setting up the project

Install the maven and clone the build then:

$ cd selenium_BDD_framework

$ mvn clean install

Execution of tests

There are 2 scenarios named as @scenario1 and @scenario2. Ran the tests on chrome54.0, firefox46 on ubuntu 14.04 64 bit

To run both scenarios (@scenario1 and @scenario2) (by default browser would be chrome):

$ mvn test

To run test with configurable browser (for firefox, use -Dbrowser=firefox)

$ mvn test -Dbrowser=chrome

To run tests headlessly

$ mvn test -Dheadless=yes

To run specific scenario:

$ mvn test -Dcucumber.options="--tags @scenario2"

To run multiple mentioned scenarios:

$ mvn test -Dcucumber.options="--tags @scenario1,@scenario2"

selenium_bdd_framework's People

Contributors

shankybnl 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.