首页 > 解决方案 > 如何在量角器中重新运行失败的黄瓜场景?

问题描述

作为测试的一部分,我使用打字稿语言来开发与量角器兼容的代码,我使用的是 BDD 框架,我在 config.ts 中定义了一些黄瓜选项,如下所示:

capabilities: {

    specs: "../example.feature"
}

cucumberOpts: {

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

onComplete: () =>{

    Reporter.createHTMLReport();
}

如格式中所述,我能够在 rerun.txt 中获得失败的场景行号,其中包含以下内容:example.feature:145:439

如何在完成测试套件之前运行此文件,如何重新运行失败的场景 3 次

标签: typescriptprotractorautomated-testscucumberjs

解决方案


从 2019 年 11 月起,您可以简单地将retry: 3(或您希望允许的多次重试)添加到您的cucumberOpts.

关于在重试失败成功后进程仍然返回退出代码 1 的问题,我已经打开了 Protractor 的问题并protractor-cucumber-framework试图解决这个问题。


推荐阅读