2017-06-22 50 views
0

我使用自动化测试实习生JS,我在找一招类似验证nightwatchjs如何断言时使用失败继续执行实习生JS

assert.isOk(false, 'this will be false') 
assert.isOk(true, 'this will be true ') 

第一个断言是失败和执行停止。但我想继续进一步的代码片段。

回答

0

我不是javascript专家,但大多数断言,程序将结束执行流程。为什么不在try/catch块中使用assert语句

try { 
    assert.isOk(false, 'this will be false') 
    assert.isOk(true, 'this will be true ') 
} 
catch (e) { 
    logMyErrors(e); // log failures or do something but don't exit 
} 
+0

您需要将每个断言封装在try/catch中。 – jason0x43