TestNG RetryAnalyzer类无法使用重新启动的测试
我已经尝试使用TestNG为Rest Assured API测试实现重试策略 重试类:TestNG RetryAnalyzer类无法使用重新启动的测试,testng,rest-assured,retry-logic,Testng,Rest Assured,Retry Logic,我已经尝试使用TestNG为Rest Assured API测试实现重试策略 重试类: public class RetryAnalyzer implements IRetryAnalyzer { private int counter = 0; private int retryLimit = 10; @Override public boolean retry(ITestResult iTestResult) { if(counter &l
public class RetryAnalyzer implements IRetryAnalyzer {
private int counter = 0;
private int retryLimit = 10;
@Override
public boolean retry(ITestResult iTestResult) {
if(counter < retryLimit)
{
counter++;
return true;
}
return false;
}
}
我故意通过添加一个“Z”来迫使它失败,我预计它会在10次之后失败。但是,第一次尝试失败。我哪里做错了
@Test(retryAnalyzer = RetryAnalyzer.class)
public void newCustomer() {
Response response =
given().spec(custServiceApi).
when().log().ifValidationFails().
post("/api/v10/customers/submit").
then().
assertThat().statusCode(200).extract().response();
String json = response.getBody().asString();
JsonPath jsonPath = new JsonPath(json);
String customerStatus = jsonPath.getString("status");
assertEquals( "SUCCESSZ", customerStatus);
}