我有问题。在我的测试用例中,每次迭代都有一个响应不同或不同的数字变量,取决于数据输入。例。第一次迭代响应一个代码和一个描述;第二次迭代响应两个代码和两个描述;和类似的。我需要插入一个BeanShell Assertion来验证每次迭代的响应。 第一步:添加一个TWO正则表达式提取器(每个变量一个)
我在BeanShell断言中的代码不起作用;仅提取每个RegEx Extractor的第一个值
String Resp_clave_g1 = vars.get("Resp_clave_g1"); //Obtained from Regular Expresion Extractor
String Resp_descripcion_g1 = vars.get("Resp_descripcion_g1"); //Obtained from Regular Expresion Extractor
String Resp_clave_g2 = vars.get("Resp_clave_g2"); //Obtained from Regular Expresion Extractor
String Resp_descripcion_g2 = vars.get("Resp_descripcion_g2"); //Obtained from Regular Expresion Extractor
String Resp_clave_g3 = vars.get("Resp_clave_g3"); //Obtained from Regular Expresion Extractor
String Resp_descripcion_g3 = vars.get("Resp_descripcion_g3"); //Obtained from Regular Expresion Extractor
String Resp_clave_g4 = vars.get("Resp_clave_g4"); //Obtained from Regular Expresion Extractor
String Resp_descripcion_g4 = vars.get("Resp_descripcion_g4"); //Obtained from Regular Expresion Extractor
String Resp_clave_g5 = vars.get("Resp_clave_g5"); //Obtained from Regular Expresion Extractor
String Resp_descripcion_g5 = vars.get("Resp_descripcion_g5"); //Obtained from Regular Expresion Extractor
String Resp_clave_g6 = vars.get("Resp_clave_g6"); //Obtained from Regular Expresion Extractor
String Resp_descripcion_g6 = vars.get("Resp_descripcion_g6"); //Obtained from Regular Expresion Extractor
log.warn (Resp_clave_g1);
log.warn (Resp_descripcion_g1);
log.warn (Resp_clave_g2);
log.warn (Resp_descripcion_g2);
log.warn (Resp_clave_g3);
log.warn (Resp_descripcion_g3);
log.warn (Resp_clave_g4);
log.warn (Resp_descripcion_g4);
log.warn (Resp_clave_g5);
log.warn (Resp_descripcion_g5);
log.warn (Resp_clave_g6);
log.warn (Resp_descripcion_g6);
if (Resp_clave_g1 != null && Resp_clave_g1.equals("${clave_1}") == false){ //Obtained from DataSet CSV
Failure = true;
FailureMessage = "Not a valid string, expected: ${clave_1}, actual value: " + Resp_clave_g1;
}else{
Failure = false;
}