npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wdio-cucumber-retry-failed-scenarios

v0.0.2

Published

Create a list of failed scenarios for re-execution in cucumber. After re-execution of failed scenarios, merge the re-execution results to the original execution results

Downloads

99

Readme

wdio-cucumber-retry-failed-scenarios

A WebdriverIO capability for re-executing Cucumber failed scenarios. This takes care of those random flaky scenarios in the suite which fail during the execution, causing false failures.

Once the automation suite has exectued all the scenarios, JSON report is generated which contains the pass/ fail status of each scenario. This capability takes that report as input and generates a feature file containing all the failed scenarios if the failure threshold is below the threshold specified in the input. The corresponding wdio config file is also generated which will run only the failed scenarios.

Once the failed scenarios have been re-executed, the corresponding execution report can be merged to the initial execution report to give a consolidated view for reporting after updating all those scenarios as passed, after re-execution.

Installation

npm install wdio-cucumber-retry-failed-scenarios

Usage

The Module contains the following functions:

identifyFailedScenarios


const retryFailedScenarios = require('wdio-cucumber-retry-failed-scenarios').retry;

let input = {
    executionResultsFolder: path_to_the_execution_results_folder,
    failureThreshold: an_integer_between_1_to_100,
    configDetails: wdio_configuration_file_details_in_JSON_format
    tag: tag_to_be_applied_to_failure_feature_file (Ex:'@tag')
}

retryFailedScenarios.identifyFailedScenarios(input);

| Parameter | Type | Details | |----------------------------------|--------|-------------------------------------------------------------------------------------------------| | executionResultsFolder | string | Path to folder where the execution results are generated in JSON format. To generate this JSON, use https://www.npmjs.com/package/cucumber-html-reporter | | failureThreshold | int | Threshold percentage of the failures beyond which re-execution will not be triggered and hence failed scenario feature file will not be generated | | configDetails | JSON | wdio configuration file details in JSON format | | tag (optional) | string | Tag expression to be applied at feature level of the failed feature file |

  • Returns true if failure percentage in the suite is less than the specified threshold. The failed scenarios would be printed on the console along with generation of the following two files:

    • One Feature file '_failedScenarios.feature' containing all the failed scenarios.
    • WDIO conf file '_failedScenariosConf.js' with 'spec' pointing to the failed feature file.

    The following command can now be used to trigger only the failed scenarios.

    ./node_modules/.bin/wdio _failedScenariosConf.js

    Both the files are generated under the root folder of the project

  • Returns false in case failure percentage is 0. Following information would be displayed and no file would be generated:

    No failed scenarios to re-run.

  • Returns false in case failure percentage is more than the specified threshhold. The failed scenarios would be printed on the console but no files would be generated. Following message would be displayed:

    More than x% of the scenarios failed. Not re-executing the failed scenarios.

updateResultFiles

Once the failed scenarios have been re-executed, call the following function to merge the re-execution results to the original execution results. It also deletes the _failedScenarios.feature and '_failedScenariosConf.js' files generated by the function identifyFailedScenarios.


retryFailedScenarios.updateResultFiles(input)

Please note that before initiating the execution, JSON results folder should be blank so that no previous execution results are used in the entire process.

TIP: gulp can be used to combine all these steps as a sequence of tasks which could then be executed against one single gulp command

Known Issues

Scenarios which contain data tables are not handled during re-execution of failure scenarios.

License

(The MIT License)

Copyright (c) 2019 Manish Kumar Singh [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2019 Manish Kumar Singh

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.