Skip to content

writetoprabha/bdd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Behavior Driven Development - Cucumber Automation Framework using Selenium

Jars Used:

  • cucumber-java - For BDD Cucumber basic features
  • cucumber-core - For BDD Cucumber basic features
  • cucumber-picocontainer - For sharing state between steps in Cucumber - JVM
  • extentreports - For reporting
  • assertj-core - For Assertions
  • commons-io - For File streaming - when generating & when reading properties
  • rest-assured - For API support
  • json-simple - For parsing JSON response
  • ExtentManager.java:

    Path: src/main/java/com/seleniumcucumber/reports

    WebConnector.java:

    Path: src/main/java/com/seleniumcucumber/webdriver
  • The WebConnector.java class contains all the common & core functions that can be accessed across different classes in the framework
  • Its constructor creates the driver object and can be accessed by StepDefinitions using PICO container (Sharing states)
  • It reads the property files (project.properties and runTest.properties) and stores the values in the public objects projectProperties and runTestProperties
  • project.properties contains contains the webelement specifications (xpath/css)
  • runTest.properties file contains test configurations like environment, browser etc
  • It also has the basic re-usable functions that can be shared across all the StepDefinitions
  • GenericSteps.java

    Path: src/test/java/com/seleniumcucumber/steps
  • The GenericSteps.java class contains all the generic step definition functions for basic operations like clicking, entering text etc.,
  • It uses the @Before annotation of Cucumber api for calling the WebConnector class's initializeReports method so that report will be initialized before the start of test execution
  • It uses the @After annotation of Cucumber api to quit the driver, flushing logs after the test execution is complete
  • The below code in this class implements the PICO container
  • WebConnector connector;    //Uses Pico container. For every scenario, the pico container object gets created and the created object is assigned to connector object.
    public GenericSteps(WebConnector connector){
        this.connector = connector;
    }
    
  • We can add any number of project specific step definition classes like this by implementing pico container in similar way
  • MyRunner.java

    Path: src/test/java/com/seleniumcucumber/
  • it is the runner class of cucumber which defines the cucumber options
  • Future Enhancements

  • Use page object model - page factory to define the objects
  • Add build.xml (Ant) file to implement Continuous Integration
  • Add functions and step defenitions to support database validations
  • Collect all the run time properties from command prompt to run the framework
  • About

    Bdd cucumber automation framework

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published