Giter Site home page Giter Site logo

cesar-rivera / wdio-rerun-service Goto Github PK

View Code? Open in Web Editor NEW

This project forked from webdriverio-community/wdio-rerun-service

0.0 1.0 0.0 1.37 MB

A WebdriverIO service that tracks failing tests and scenarios, allowing failing or unstable tests or scenarios to be re-run.

Home Page: https://www.npmjs.com/package/wdio-rerun-service

License: MIT License

TypeScript 100.00%

wdio-rerun-service's Introduction

WebdriverIO Re-run Service

wdio-rerun-service CI npm npm bundle size GitHub issues

This service tracks failing Mocha or Jasmine tests and Cucumber scenarios executed within the WebdriverIO test framework. It will allow failing or unstable tests or scenarios to be re-run.

NOTE: Users running WebdriverIO versions 5.x.x and 6.x.x should use version 1.6.x. If you are on 7.x.x, use version 1.7.x version of this service. If you are on the latest major version of 8.x.x, use the latest 2.x.x version of this service.

Re-run vs. Retry

The retry logic built into WebdriverIO for Cucumber and Mocha/Jasmine is helpful for handling flaky steps in Cucumber and Mocha/Jasmine. Retrying in each framework has caveats:

  • Cucumber: It does not take into account that some steps may not be able to be retried in the middle of a test. Running a step twice may break the rest of the Scenario or it may not be possible in the test context.
  • Mocha/Jasmine: The retry logic may be applied to an individual test, however, this is still done in real-time and perhaps does not account for temporal issues or network connectivity problems.

The main distinctions of the re-run:

  • Will re-run an entire individual Cucumber Scenario and not just a single step
  • Enables an entire spec file to be re-run after a main test execution is complete
  • May be copied and executed locally (retry cannot)
  • Can still be used in conjunction with retry methods
  • Does not require any code change to apply retry logic to flaky or problematic tests

It is recommended to take some time to evaluate the options available. A hybrid solution may be the best solution to provide the best real and actionable test results.

Installation

Using npm:

npm install wdio-rerun-service

or using yarn:

yarn add wdio-rerun-service

After package installation is complete, add it to services array in wdio.conf.js:

// wdio.conf.js
import RerunService from 'wdio-rerun-service';
export const config = {
    // ...
    services: [RerunService, {
        // ...
    }]
};

Instructions on how to install WebdriverIO can be found here.

Configuration

The following options may be added to the wdio.conf.js file. To define options for the service you need to add the service to the services list in the following way:

// wdio.conf.js
import RerunService from 'wdio-rerun-service';
export const config = {
    // ...
    services: [
        [RerunService, {
            // Re-run service options here...
        }]
    ],
    // ...
};

rerunDataDir

Directory where all the re-run JSON data will be kept during execution.

Type: String

Default: ./results/rerun

Example:

import RerunService from 'wdio-rerun-service';
export const config = {
    // ...
    services: [
        [RerunService, {
            rerunDataDir: './custom-rerun-directory'
        }]
    ],
    // ...
}

rerunScriptPath

Path to write re-run Bash script.

Type: String

Default: ./rerun.sh

Example:

import RerunService from 'wdio-rerun-service';
export const config = {
    // ...
    services: [
        [RerunService, {
            rerunScriptPath: './custom-path-for-rerun.sh'
        }]
    ],
    // ...
}

ignoredTags

(Cucumber-only) Set of Cucumber tags to exclude. If scenario contains a tag, the re-run service will skip analysis.

Type: Array

Default: []

Example:

import RerunService from 'wdio-rerun-service';
export const config = {
    // ...
    services: [
        [RerunService, {
            ignoredTags: ['@known_bug']
        }]
    ],
    // ...
}

commandPrefix

Prefix which will be added to the re-run command that is generated.

Type: String

Default: ''

Example:

import RerunService from 'wdio-rerun-service';
export const config = {
    // ...
    services: [
        [RerunService, {
            commandPrefix: "VARIABLE=true"
        }]
    ],
    // ...
}

customParameters

Parameters which will be added to the re-run command that is generated. Can be used with commandPrefix.

Type: String

Default: ''

Example:

import RerunService from 'wdio-rerun-service';
export const config = {
    // ...
    services: [
        [RerunService, {
            customParameters: "--foobar"
        }]
    ],
    // ...
}

wdio-rerun-service's People

Contributors

aizaztoppa avatar esaari avatar lamkovod avatar nav-2d avatar scg82 avatar sw-carlos-cristobal avatar wdio-bot avatar yopasa94 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.