How to rerun the failed cucumber scenarios in protractor?

我们两清 提交于 2019-12-21 18:58:07

问题


As a part of testing, i was using typescript language to develop the code which will be compatible for protractor, i was using BDD framework in which i had defined some cucumber options in my config.ts as following:

capabilities: {

    specs: "../example.feature"
}

cucumberOpts: {

    compiler: "ts:ts-node/register",
    format: "rerun:./reports/rerun.txt",
    require: "../../stepdefinations/*.ts",
    strict: true
}

onComplete: () =>{

    Reporter.createHTMLReport();
}

As mentioned in format, i was able to get the failed scenario line numbers in the rerun.txt which contains as following: example.feature:145:439

How to run this file before completing the test suite, how to rerun the failed scenarios for 3 times


回答1:


You can not currently rerun the failed tests in the same suite as your initial run. What it sounds like you want is retry functionality which there are actually pull requests up for

https://github.com/cucumber/cucumber-js/pull/1229
https://github.com/cucumber/cucumber-js/pull/1205/commits

What you need to do right now is rerun cucumber again against that txt file, to learn how to do that, check out https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#formats




回答2:


As of November 2019, you can simply add retry: 3 (or however many retries you want to allow) to your cucumberOpts.

There is one issue with this regarding the process still returning an exit code of 1 after retried failures succeed, I have opened issues with Protractor and protractor-cucumber-framework trying to address this.



来源:https://stackoverflow.com/questions/58096754/how-to-rerun-the-failed-cucumber-scenarios-in-protractor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!