Giter Club home page Giter Club logo

webdriver-framework-cucumber-java's Introduction

About

The repository is a web driver manager framework for java-cucumber based tests. It contains APIs for running your tests, injecting web driver and plugin for reporting and rerun.

Events

BuildStarted => Instant

RuntimeCreated => Instant,RuntimeOptions

BatchExecutionStarted => Instant, Batch (int)

ExecutionStarted => Instant,Execution

WebDriverCreated => Instant, WebDriver

ExecutionCompleted => Instant,Execution,WebDriver

BatchExecutionCompleted => Instant, Batch (int)

BuildCompleted => Instant

Plugins

WebDriverManager

Plugin Purpose
WebDriverCreated Copies and delivers web driver to the tests
TestCaseFinished MarkAndCloseWebDriver

RerunExecutionManager

Plugin Purpose
ExecutionStarted Copies execution for rerun
TestCaseFinished Push execution for rerun in next batch
BatchExecutionCompleted Fires next batch failed tests for run

Note : This plugin takes a parameter for maximum reruns

CustomReportListener

Plugin Purpose
BuildStarted Record build start time
RuntimeCreated Record runtime options
BatchExecutionStarted Records the current batch
ExecutionStarted Record the features executed
TestStepFinished Record the step
TestCaseFinished Record the test case
BuildCompleted Record build end time & Generate reports

Note : This plugin takes a parameter for report path. Ensure you have the mustache templates, js and css ready in src/test/resources/reporter directory.

Other Classes

Plugin Purpose
BatchExecutionRunner Executes tests on provided list of platforms
Execution Current combination of pickle & Platform
WebDriverRuntime Entry point for running tests
WebDriverTestRunner External Facing API

How to run a test with this library?

1.Clone this repository

git clone [email protected]:raveerocks/webdriver-framework-cucumber-java.git

  1. Install it in your local repository
mvn clean install
  1. Use within your Java project
<dependency>
    <groupId>com.browserstack</groupId>
    <artifactId>webdriver-framework-cucumber-java</artifactId>
    <version>0.0.1</version>
</dependency>
  1. Run the tests within your framework with WebDriverTestRunner and required CucumberOptions
public class Test{
    public void testMethod(){
        String[] argv = new String[]{
                CommandlineOptions.GLUE, "", "src/test/resources/com/browserstack"};
        WebDriverTestRunner.run(true,argv);
    }
}
  1. Enable required plugins and options you need
public class Test{
    public void testMethod(){
        String[] argv = new String[]{
                CommandlineOptions.THREADS,"25",
                CommandlineOptions.PLUGIN,"com.browserstack.rerun.RerunExecutionManager:2",
                CommandlineOptions.PLUGIN,"com.browserstack.report.CustomReportListener:target/reports",
                CommandlineOptions.NAME,"End to End Scenario",
                CommandlineOptions.GLUE, "", "src/test/resources/com/browserstack"};
        WebDriverTestRunner.run(true,argv);
    }
}
  1. Within your test steps are a base class use WebDriverTestRunner to get the web driver
public class BaseStep {

    WebDriverHolder webDriverHolder = new WebDriverHolder();

    public WebDriver getWebDriver(){
        return WebDriverTestRunner.getWebDriver();
    }
    
}

webdriver-framework-cucumber-java's People

Contributors

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