如何在量角器中重新运行失败的黄瓜场景? [英] How to rerun the failed cucumber scenarios in protractor?

查看:21
本文介绍了如何在量角器中重新运行失败的黄瓜场景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

功能:{规格:../example.feature"}黄瓜选择:{编译器:ts:ts-node/register",格式:重新运行:./reports/rerun.txt",要求:../../stepdefinations/*.ts",严格:真}onComplete: () =>{Reporter.createHTMLReport();}

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

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

解决方案

从 2019 年 11 月起,您只需将 retry: 3 (或您希望允许的任何重试次数)添加到您的 cucumberOpts.

这有一个问题,即在重试失败成功后进程仍然返回退出代码 1,我已经打开了 Protractor 的问题,protractor-cucumber-framework 试图解决这个问题.p>

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

解决方案

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.

这篇关于如何在量角器中重新运行失败的黄瓜场景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆