Skip to content

prashant1507/BDD_Automation_Framework

Repository files navigation

BDD Cucumber Automation Framework

This is a bdd java selenium framework which is using testng, maven, extent report, selenium, java, etc to achieve different tasks.

Project's Java Docs
Sample Test Report
Sample Test Video
Execution Settings
Feature Files
Step Files

Project Features

  • Supports parallel features execution.
  • Multiple browsers can be setup.
  • Generates report after each run for all test cases with screenshots.
  • Record video for failed and skipped test cases.
  • Option to auto manage drives using WebDriverManager.
  • Option to send report to email (Gmail / Outlook).
  • Option to run tests on local or remote.
  • Read data from Properties file, Excel, JSON files.
  • Real time reporting using ELK.
  • Option to run on docker grid, local, zalenium or selenoid.
  • On-demand browser instance creation using Dynamic Selenium Grid 4.
  • On-demand browser instance creation using Zalenium.
  • Run using JenkinsFile.

Docker Compose File

Project Components

Below are the component details of the framework:

  • Browser interaction using

    selenium

  • Test Data

    Supports to read and maintain data from multiple file types like:

    • Properties File
    • Excel File with the help of ApachePOI Jars
    • JSON File
  • Test Scripts

    Cucumber TestNg is used as a unit test framework in order to generate test script taking into account the Page Object Model design pattern.

    All the feature files are in Features

  • Build Tool

    Using maven, project dependencies are managed. Test can be run using pom.xml and testng.xml.

  • Reporting

    Generates html report automatically by using Extent Report 5. By attaching screenshots and execution videos of the failed test cases.
    However, user can set the framework to take screenshots and videos of passed or/and skipped test cases. All reports are generated in reports-test-output folder. Report automatically opens in default browser.
    Note: Exception logs and fail reasons are added to the report as well. All images are in Base64 and videos in mp4.

  • Utilities

    Holds common methods to re-use in order to achieve maximum re-usability.

  • Test Runner

    • Tests can be executed in parallel and in cross browsers by using:
    • Tests can be executed using:
      • local browsers
      • remote browsers
      • docker selenium grid
      • selenium grid
      • selenoid
      • zalenium
  • Other Components

    • JavaMail API and JavaBeans(TM) Activation Framework is used to send the test report automatically on email using gmail or outlook. However, user can still decide if report has to be send or not.
      Note: Framework allows passwords in Base64Encode only.
    • All framework settings are done in properties file, making it easy for a non-technical user.
    • User can opt to run the test with their web drivers placed in drivers folder or with WebDriverManager.

Getting Started:

  1. Set all the properties/setting in properties file.
  2. Run pom.xml or testng.xml file.

Settings for Properties file

Path to properties file

  • url of the test environment.
  • environment where the test has to be performed.
  • testername inorder to keep track.
  • downloadwebdriver to decide if tester want to place the drivers or wants the framework to download it with the help of WebDriverManager.
  • runmode decides whether to run test cases on local, grid (/ docker-grid), zalenium or selenoid. Accepts yes or no.
    • if runmode is yes then user has to provide the remote url in remoteurl.
  • useelk yes if elk is deployed
    • elksuiteurl if yes provide the url for kibana
  • To delete old report data:
    deleteoldreports - to elect if tester wants to delete old reports. Accepts yes or no.
    numberofdays - if yes than how old the files should be. Value in number of days.
    
  • overridereports to elect if tester want all reports to be merged in one i.e., current reports plus old ones or create new report for each test suite run. Accepts yes or no.
  • Screenshots:
    passedscreenshot - to take screenshot of passed test cases. Accepts yes or no.
    
  • retryfailedtestcasesto re-run fail test cases. Accepts yes or no. Not recommended setting to set it as yes.
  • Email details to send report:
    sendmailafterexecution - to send report. Accepts yes or no.
    sendmailusing - to choose from gmail or outlook.
    emailid - sender's email id.
    emailpassword - sender's password in Base64Encode only.
    receiversemailid - receiver's email id.
    
    Note: In order to use gmail then enable Allow less secure apps
  • Setup real time report using ELK:
    useelk - to enable using real time reporting using ELK. Accepts yes or no.
    elksuiteurl - url of the elastic search data add.
    
    Note: To use ELK, set the schema to have below keys:
    • TestName

    • Status

    • ExecutionTime

      Note: More fields can be added and changes should be done accordingly in ELKUtils.class

How to set up:

Notes:

  1. For Jenkins to support extent reporting (or other CSS, etc. components ) run below in scripts https://jenkisURL/script System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","")
  2. Uses lombok.

References: