【问题标题】:How to rerun failed step/secnario of a feature file in cucumber using webdriverio如何使用 webdriverio 重新运行黄瓜中功能文件的失败步骤/secnario
【发布时间】:2018-12-13 17:52:06
【问题描述】:

请帮忙。我正在使用以下黄瓜选项:

cucumberOpts: {
    backtrace: false,
    failAmbiguousDefinitions: true,
    failFast: false,
    ignoreUndefinedDefinitions: false,
    name: [],
    snippets: true,
    source: true,
    profile: [],
    require: [
        './features/step_definitions/given.js',
        './features/step_definitions/when.js',
        './features/step_definitions/then.js',
    ],
    snippetSyntax: undefined,
    strict: true,
    tagExpression: '@Test',
    tagsInTitle: false,
    timeout: 20000000,
},

【问题讨论】:

  • 这个 Akhilesh 有什么进展吗?

标签: selenium cucumber appium webdriver-io


【解决方案1】:

https://www.npmjs.com/package/wdio-rerun-service 最近专门针对 WebdriverIO 发布,它适用于 Cucumber 功能/场景。

【讨论】:

    【解决方案2】:

    我假设您使用的是 wdio-cucumber-framework,那么您可以重新运行各个步骤特定次数,如下所示:

    module.exports = function () {
        /**
         * The following STEP DEFINITION will run maximum 3 times!
         * => 1 actual run + 2 reruns (on failure)
         */
        this.Given(/^Your step definition here$/, { wrapperOptions: { retry: 2 } }, () => {
            // ...
        });
    });
    

    !注意:wrapperOptions 是传递给定义函数包装器的特定于步骤的选项。在我们的例子中,retry 选项。您可以在 Cucumber DOCS 中阅读更多相关信息。

    如果您需要控制测试用例或测试套件的重试,那么遗憾的是 Cucumber 还没有这样的功能。但是,如果你想要这样的东西,也许用摩卡代替。这是few examples

    【讨论】:

      猜你喜欢
      • 2017-05-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多