1:把插入日志级别改成大写

This commit is contained in:
seagull 2017-09-13 11:49:59 +08:00
parent 49bb4ac2ad
commit 88b21a9344
1 changed files with 15 additions and 15 deletions

View File

@ -49,7 +49,7 @@ public class WebTestCaseDebug{
functionname = casescript.get("FunctionName").toString();
}catch(Exception e){
k=0;
GetServerAPI.cPostDebugLog(sign, executor, "error", "解析包名或是方法名失败,请检查!");
GetServerAPI.cPostDebugLog(sign, executor, "ERROR", "解析包名或是方法名失败,请检查!");
e.printStackTrace();
break; //某一步骤失败后此条用例置为失败退出
}
@ -99,7 +99,7 @@ public class WebTestCaseDebug{
uservariable = casescript.get("FunctionParams"+(j+1)).substring(casescript.get("FunctionParams"+(j+1)).indexOf("@")+1,
casescript.get("FunctionParams"+(j+1)).indexOf(uservariable1)-1);
}else{
GetServerAPI.cPostDebugLog(sign, executor, "warning", "你好像在一个参数中引用了超过3个以上的变量哦我处理不过来啦");
GetServerAPI.cPostDebugLog(sign, executor, "WARNING", "你好像在一个参数中引用了超过3个以上的变量哦我处理不过来啦");
}
Iterator keys = variable.keySet().iterator();
String key = null;
@ -150,11 +150,11 @@ public class WebTestCaseDebug{
ParameterValues = ParameterValues.replaceAll(""", "\"");
ParameterValues = ParameterValues.replaceAll("'", "\'");
}
GetServerAPI.cPostDebugLog(sign, executor, "info", "解析包名:"+packagename+" 方法名:"+functionname
GetServerAPI.cPostDebugLog(sign, executor, "INFO", "解析包名:"+packagename+" 方法名:"+functionname
+""+(j+1)+"个参数:"+ParameterValues);
getParameterValues[j] = ParameterValues;
}else{
GetServerAPI.cPostDebugLog(sign, executor, "warning", "没有找到你要的变量哦,再找下吧!第一个变量名称是:"+uservariable+",第"
GetServerAPI.cPostDebugLog(sign, executor, "WARNING", "没有找到你要的变量哦,再找下吧!第一个变量名称是:"+uservariable+",第"
+ "二个变量名称是:"+uservariable1+",第三个变量名称是:"+uservariable2);
}
@ -165,7 +165,7 @@ public class WebTestCaseDebug{
ParameterValues1 = ParameterValues1.replaceAll("'", "\'");
ParameterValues1 = ParameterValues1.replaceAll("@@", "@");
}
GetServerAPI.cPostDebugLog(sign, executor, "info", "解析包名:"+packagename+" 方法名:"+functionname
GetServerAPI.cPostDebugLog(sign, executor, "INFO", "解析包名:"+packagename+" 方法名:"+functionname
+""+(j+1)+"个参数:"+ParameterValues1);
getParameterValues[j] = ParameterValues1;
}
@ -175,7 +175,7 @@ public class WebTestCaseDebug{
}
//调用动态方法执行测试用例
try{
GetServerAPI.cPostDebugLog(sign, executor, "info", "开始调用方法:"+functionname+" .....");
GetServerAPI.cPostDebugLog(sign, executor, "INFO", "开始调用方法:"+functionname+" .....");
if(expectedresults.length()>2 && expectedresults.substring(0, 2).indexOf("$=")>-1){ //把预期结果前两个字符判断是否是要把结果存入变量
String ExpectedResultVariable = casescript.get("ExpectedResults").toString().substring(2);
String temptestnote = InvokeMethod.CallCase(packagename,functionname,getParameterValues,steps.get(i).getSteptype(),steps.get(i).getAction());
@ -184,10 +184,10 @@ public class WebTestCaseDebug{
testnote = InvokeMethod.CallCase(packagename,functionname,getParameterValues,steps.get(i).getSteptype(),steps.get(i).getAction());
if(testnote.indexOf(expectedresults.substring(2))>-1){
setresult = 0;
GetServerAPI.cPostDebugLog(sign, executor, "info", "用例执行结果是:"+testnote+",与预期结果匹配成功!");
GetServerAPI.cPostDebugLog(sign, executor, "INFO", "用例执行结果是:"+testnote+",与预期结果匹配成功!");
}else{
setresult = 1;
GetServerAPI.cPostDebugLog(sign, executor, "error", ""+(i+1)+"步执行结果与预期结果匹配失败!"+"预期结果:"+expectedresults+" 测试结果:"+testnote);
GetServerAPI.cPostDebugLog(sign, executor, "ERROR", ""+(i+1)+"步执行结果与预期结果匹配失败!"+"预期结果:"+expectedresults+" 测试结果:"+testnote);
testnote = "用例第"+(i+1)+"步执行结果与预期结果匹配失败!";
break; //某一步骤失败后此条用例置为失败退出
}
@ -195,10 +195,10 @@ public class WebTestCaseDebug{
testnote = InvokeMethod.CallCase(packagename,functionname,getParameterValues,steps.get(i).getSteptype(),steps.get(i).getAction());
if(expectedresults.equals(testnote)){
setresult = 0;
GetServerAPI.cPostDebugLog(sign, executor, "info", "用例执行结果是:"+testnote+",与预期结果匹配成功!");
GetServerAPI.cPostDebugLog(sign, executor, "INFO", "用例执行结果是:"+testnote+",与预期结果匹配成功!");
}else{
setresult = 1;
GetServerAPI.cPostDebugLog(sign, executor, "error", ""+(i+1)+"步执行结果与预期结果匹配失败!"+"预期结果:"+expectedresults+" 测试结果:"+testnote);
GetServerAPI.cPostDebugLog(sign, executor, "ERROR", ""+(i+1)+"步执行结果与预期结果匹配失败!"+"预期结果:"+expectedresults+" 测试结果:"+testnote);
testnote = "用例第"+(i+1)+"步执行结果与预期结果匹配失败!";
break; //某一步骤失败后此条用例置为失败退出
}
@ -209,7 +209,7 @@ public class WebTestCaseDebug{
}
}catch(Exception e){
setresult = 1;
GetServerAPI.cPostDebugLog(sign, executor, "error", "调用方法过程出错,方法名:"+functionname+" 请重新检查脚本方法名称以及参数!");
GetServerAPI.cPostDebugLog(sign, executor, "ERROR", "调用方法过程出错,方法名:"+functionname+" 请重新检查脚本方法名称以及参数!");
testnote = "CallCase调用出错";
e.printStackTrace();
break;
@ -218,14 +218,14 @@ public class WebTestCaseDebug{
variable.clear(); //清空传参MAP
//如果调用方法过程中未出错进入设置测试结果流程
if(testnote.indexOf("CallCase调用出错")<=-1&&testnote.indexOf("解析出错啦!")<=-1){
GetServerAPI.cPostDebugLog(sign, executor, "infoover", "用例 "+sign+"解析成功,并成功调用用例中方法,请继续查看执行结果!");
GetServerAPI.cPostDebugLog(sign, executor, "INFOover", "用例 "+sign+"解析成功,并成功调用用例中方法,请继续查看执行结果!");
}else{
GetServerAPI.cPostDebugLog(sign, executor, "errorover", "用例 "+sign+"解析或是调用步骤中的方法出错!");
GetServerAPI.cPostDebugLog(sign, executor, "ERRORover", "用例 "+sign+"解析或是调用步骤中的方法出错!");
}
if(setresult == 0){
GetServerAPI.cPostDebugLog(sign, executor, "infoover", "用例 "+sign+"步骤全部执行成功!");
GetServerAPI.cPostDebugLog(sign, executor, "INFOover", "用例 "+sign+"步骤全部执行成功!");
}else{
GetServerAPI.cPostDebugLog(sign, executor, "errorover", "用例 "+sign+"在执行过程中失败,请检查!");
GetServerAPI.cPostDebugLog(sign, executor, "ERRORover", "用例 "+sign+"在执行过程中失败,请检查!");
}
}