空手道测试框架中的重试机制如何在空手道测试框架中重试失败的测试,如Junit和TestNG。类似于公共类重试的内容实现了IRetryAnalyzer {
private int count = 0;
private static int maxTry = 3;
@Override
public boolean retry(ITestResult iTestResult) {
if (!iTestResult.isSuccess()) { //Check if test not succeed
if (count < maxTry) { //Check if maxtry count is reached
count++; //Increase the maxTry count by 1
iTestResult.setStatus(ITestResult.FAILURE); //Mark test as failed
return true; //Tells TestNG to re-run the test
} else {
iTestResult.setStatus(ITestResult.FAILURE); //If maxCount reached,test marked as failed
}
} else {
iTestResult.setStatus(ITestResult.SUCCESS); //If test passes, TestNG marks it as passed
}
return false;
}}
发布于 2019-12-28 01:58:29
它适用于我的0.9.5.RC5版本。但是,也许这是前面提到的“变通办法”之一?
你所要做的就是这样,默认为3次尝试:
* retry until responseStatus == 404
When method get

发布于 2018-03-22 10:53:33
到目前为止,这是一个开放的功能请求:https://github.com/intuit/karate/issues/247
但是有多项工作要做。如果您看一下投票示例,您可能会得到一些概念:https://github.com/intuit/karate/blob/master/karate-demo/src/test/java/demo/polling/polling.feature
https://stackoverflow.com/questions/49411233
复制相似问题