gpt4 book ai didi

javascript - 如何在 CasperJS 断言失败时继续测试用例?

转载 作者:数据小太阳 更新时间:2023-10-29 05:54:44 26 4
gpt4 key购买 nike

有没有办法在发生故障时继续测试套件?例如:

casper.test.begin("",3,function suite(){
casper.start(url).then(function(){
test.assert(...);
test.assert(...); //If this assert fail, the script stop and the third assert isn't tested
test.assert(...);
}).run(function(){
test.done();
});
});

我希望所有断言都经过测试,即使有些失败。可能吗?

最佳答案

参见casperjs google group post .我们可以用 casper.then(..

包围断言

下面的代码按我想要的方式工作(但这种方式可能不是最好的?)

casper.test.begin("",3,function suite(){
casper.start(url).then(function(){
casper.then(function(){
test.assert(...); //if fail, this suite test continue
});
casper.then(function(){
test.assert(...); //so if assert(1) fail, this assert is executed
});
casper.then(function(){
test.assert(...);
});
}).run(function(){
test.done();
});
});

关于javascript - 如何在 CasperJS 断言失败时继续测试用例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27760543/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com