优化接口类型步骤支持runcase的关键字出现的Bug
This commit is contained in:
parent
d4918b4160
commit
ff0e4223bb
|
@ -41,6 +41,8 @@ public class ApiTestCaseDebug {
|
|||
*/
|
||||
public static void oneCaseDebug(String testCaseExternalId) {
|
||||
Map<String, String> variable = new HashMap<>(0);
|
||||
// 初始化写用例结果以及日志模块
|
||||
serverOperation caselog = new serverOperation();
|
||||
serverOperation.exetype=1;
|
||||
String packagename;
|
||||
String functionname;
|
||||
|
@ -64,7 +66,7 @@ public class ApiTestCaseDebug {
|
|||
// 进入循环,解析用例所有步骤
|
||||
for (int i = 0; i < steps.size(); i++) {
|
||||
Map<String, String> casescript = InterfaceAnalyticCase.analyticCaseStep(testcase, steps.get(i), "888888",
|
||||
null,variable);
|
||||
caselog,variable);
|
||||
try {
|
||||
packagename = casescript.get("PackageName");
|
||||
functionname = casescript.get("FunctionName");
|
||||
|
@ -97,8 +99,14 @@ public class ApiTestCaseDebug {
|
|||
// 调用动态方法,执行测试用例
|
||||
try {
|
||||
LogUtil.APP.info("开始调用方法:{} .....",functionname);
|
||||
testnote = InvokeMethod.callCase(packagename, functionname, getParameterValues,
|
||||
steps.get(i).getStepType(), steps.get(i).getExtend());
|
||||
// 接口用例支持使用runcase关键字
|
||||
if ((null != functionname && "runcase".equals(functionname))) {
|
||||
TestCaseExecution testCaseExecution=new TestCaseExecution();
|
||||
testnote = testCaseExecution.oneCaseExecuteForCase(getParameterValues[0].toString(), "888888", variable, caselog, null);
|
||||
}else{
|
||||
testnote = InvokeMethod.callCase(packagename, functionname, getParameterValues,
|
||||
steps.get(i).getStepType(), steps.get(i).getExtend());
|
||||
}
|
||||
testnote = ActionManageForSteps.actionManage(casescript.get("Action"), testnote);
|
||||
if (null != expectedresults && !expectedresults.isEmpty()) {
|
||||
LogUtil.APP.info("expectedResults=【{}】",expectedresults);
|
||||
|
|
|
@ -118,7 +118,13 @@ public class TestCaseExecution {
|
|||
try {
|
||||
LogUtil.APP.info("开始调用方法:{} .....",functionname);
|
||||
caselog.insertTaskCaseLog(taskid, testcase.getCaseId(), "开始调用方法:" + functionname + " .....", "info", String.valueOf(i + 1), "");
|
||||
testnote = InvokeMethod.callCase(packagename, functionname, getParameterValues, steps.get(i).getStepType(), steps.get(i).getExtend());
|
||||
// 接口用例支持使用runcase关键字
|
||||
if ((null != functionname && "runcase".equals(functionname))) {
|
||||
TestCaseExecution testCaseExecution=new TestCaseExecution();
|
||||
testnote = testCaseExecution.oneCaseExecuteForCase(getParameterValues[0].toString(), taskid, RUNCASE_VARIABLE, caselog, null);
|
||||
}else{
|
||||
testnote = InvokeMethod.callCase(packagename, functionname, getParameterValues, steps.get(i).getStepType(), steps.get(i).getExtend());
|
||||
}
|
||||
testnote = ActionManageForSteps.actionManage(casescript.get("Action"), testnote);
|
||||
// 判断结果
|
||||
int stepresult = interfaceJudgeResult(testcase, steps.get(i), taskid, expectedresults, testnote, caselog);
|
||||
|
@ -185,6 +191,10 @@ public class TestCaseExecution {
|
|||
String testnote = "初始化测试结果";
|
||||
ProjectCase testcase = GetServerApi.cgetCaseBysign(testCaseExternalId);
|
||||
List<ProjectCaseParams> pcplist = GetServerApi.cgetParamsByProjectid(String.valueOf(testcase.getProjectId()));
|
||||
if(null==caselog){
|
||||
// 初始化写用例结果以及日志模块
|
||||
caselog = new serverOperation();
|
||||
}
|
||||
// 把公共参数加入到MAP中
|
||||
for (ProjectCaseParams pcp : pcplist) {
|
||||
RUNCASE_VARIABLE.put(pcp.getParamsName(), pcp.getParamsValue());
|
||||
|
@ -312,7 +322,13 @@ public class TestCaseExecution {
|
|||
LogUtil.APP.info("二次解析用例过程完成,等待进行接口操作......");
|
||||
caselog.insertTaskCaseLog(taskid, projectCase.getCaseId(), "包路径: " + packagename + "; 方法名: " + functionname, "info", String.valueOf(step.getStepSerialNumber()), "");
|
||||
|
||||
result = InvokeMethod.callCase(packagename, functionname, getParameterValues, step.getStepType(), step.getExtend());
|
||||
// 接口用例支持使用runcase关键字
|
||||
if ((null != functionname && "runcase".equals(functionname))) {
|
||||
TestCaseExecution testCaseExecution=new TestCaseExecution();
|
||||
result = testCaseExecution.oneCaseExecuteForCase(getParameterValues[0].toString(), taskid, RUNCASE_VARIABLE, caselog, null);
|
||||
}else{
|
||||
result = InvokeMethod.callCase(packagename, functionname, getParameterValues, step.getStepType(), step.getExtend());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.APP.error("调用方法过程出错,方法名:{},请重新检查脚本方法名称以及参数!",functionname,e);
|
||||
|
|
|
@ -116,8 +116,8 @@ public class ThreadForExecuteCase extends Thread {
|
|||
testnote = testCaseExecution.oneCaseExecuteForCase(getParameterValues[0].toString(), taskid, variable, caselog, null);
|
||||
}else{
|
||||
testnote = InvokeMethod.callCase(packagename, functionname, getParameterValues, steps.get(i).getStepType(), steps.get(i).getExtend());
|
||||
testnote = ActionManageForSteps.actionManage(casescript.get("Action"), testnote);
|
||||
}
|
||||
testnote = ActionManageForSteps.actionManage(casescript.get("Action"), testnote);
|
||||
|
||||
if (null != expectedresults && !expectedresults.isEmpty()) {
|
||||
LogUtil.APP.info("expectedResults=¡¾{}¡¿",expectedresults);
|
||||
|
|
|
@ -106,8 +106,8 @@ public class WebTestCaseDebug {
|
|||
testnote = testCaseExecution.oneCaseExecuteForCase(getParameterValues[0].toString(), "888888", variable, caselog, null);
|
||||
}else{
|
||||
testnote = InvokeMethod.callCase(packagename, functionname, getParameterValues, steps.get(i).getStepType(), steps.get(i).getExtend());
|
||||
testnote = ActionManageForSteps.actionManage(casescript.get("Action"), testnote);
|
||||
}
|
||||
testnote = ActionManageForSteps.actionManage(casescript.get("Action"), testnote);
|
||||
|
||||
if (null != expectedresults && !expectedresults.isEmpty()) {
|
||||
// ¸³Öµ´«²Î
|
||||
|
|
Loading…
Reference in New Issue