繁体   English   中英

我可以跳过黄瓜中未定义的步骤吗?

[英]Can I skip undefined steps in Cucumber?

我具有前端和后端测试使用的相同功能文件,它们具有自己的步骤定义。 对于后端,我想跳过一些步骤(例如,前端导航)。

我可以写空的步骤定义,这会将步骤标记为已完成。 我希望将它们标记为“已跳过”。

但是,存在一个问题:如果我有未定义的步骤,则测试将失败。 如何配置Cucumber跳过该步骤,然后再继续?

我更喜欢Javascript答案

无论如何,我将定义步骤。

您的步骤定义将如下所示:

When("I go to the home page", notApplicable);
When("I go to page X", notApplicable);
When("I go to page Y", notApplicable);
When("I go to page Z", notApplicable);

function notApplicableStep() {
    console.log("Skipped. This step is not applicable.");
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM