循环执行
1、循环读取csv文件的值
2、foreach 读取变量,变量数字后缀有序递增,通过counter实现
${__V(typeId${typeIdNum})}
beansell断言
String typeIdNum = vars.get("typeIdNum");
String response = prev.getResponseDataAsString(); //获取当前请求响应结果
if (typeIdNum == 0 ||typeIdNum == 2||typeIdNum == 3||typeIdNum == 4||typeIdNum == 5||typeIdNum == 6){
if (response.contains("00000") == false){
log.info("==========取到的typeIdNum值:"+typeIdNum);
Failure = true;
String Msg = "\n系统返回响应结果与期望结果不一致!"; FailureMessage = Msg + "\n" + "期望结果:\n" +"00000" + "\n" + "响应内容: \n" + response +"\n";
return;
}else{
log.info("==========进这里面了"+typeIdNum);
Failure = false;
return;
}
}
else{
if (typeIdNum ==1&& response.contains("A00004") == false){
log.info("==========取到的typeIdNum值:"+typeIdNum);
Failure = true;
String Msg = "\n系统返回响应结果与期望结果不一致!"; FailureMessage = Msg + "\n" + "期望结果:\n" +"A00004" + "\n" + "响应内容: \n" + response +"\n";
return;
}
if (typeIdNum ==7&& response.contains("11210003") == false){
log.info("==========取到的typeIdNum值:"+typeIdNum);
Failure = true;
String Msg = "\n系统返回响应结果与期望结果不一致!"; FailureMessage = Msg + "\n" + "期望结果:\n" +"11210003" + "\n" + "响应内容: \n" + response +"\n";
return;
}
log.info("==========进这里面了"+typeIdNum);
Failure = false;
return;
}
}
3、foreach
JMeter教程之ForEach控制器详解 - 51Testing软件测试网