在Webdriver.io中有条件地运行it()块或嵌套it()



当第一个it((块断言失败时,我正试图在Webdriver.io中进行测试。是否可以嵌套it((块或有条件地执行它们?

对于您的第一个问题"我正在尝试在Webdriver.io中进行测试,当第一个it((块断言失败时停止",答案如下:-

你可以使用这里描述的摩卡"保释"选项摩卡保释

命令行用法:-

--bail, -b                 Abort ("bail") after first test failure   [boolean]

而且,在任何像这样的配置文件中

"bail" : true 
Any "boolean" flag (which doesn't require a parameter, such as --bail), can be specified using a boolean value, e.g.: "bail": true.

对于您关于it语句的条件执行的第二个问题,请参阅下面的代码

describe("Some module", function() {
if(false) {
it ("should NOT run this test case", function() { });
}
it("should run this test case", function() { });  });

如果你需要更多的帮助,请告诉我。

最新更新