fix(接口测试): 用例执行状态处理

--bug=1007755 --user=赵勇 【接口测试】case批量执行一直是进行中,并且没有显示结果 https://www.tapd.cn/55049933/s/1065437
This commit is contained in:
fit2-zhao 2021-11-08 16:19:57 +08:00 committed by fit2-zhao
parent 3c30089dfa
commit 3ba19fbf5b
1 changed files with 8 additions and 1 deletions

View File

@ -795,8 +795,8 @@ public class ApiTestCaseService {
sqlSession.commit();
for (RunCaseRequest runCaseRequest : executeQueue) {
run(runCaseRequest);
MessageCache.batchTestCases.put(runCaseRequest.getReportId(), runCaseRequest.getReport());
run(runCaseRequest);
}
}
@ -819,6 +819,13 @@ public class ApiTestCaseService {
jMeterService.runLocal(request.getReportId(), jmeterHashTree, null, request.getRunMode());
} catch (Exception ex) {
ApiDefinitionExecResult result = MessageCache.batchTestCases.get(request.getReportId());
result.setStatus("error");
apiDefinitionExecResultMapper.updateByPrimaryKey(result);
ApiTestCaseWithBLOBs caseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(request.getCaseId());
caseWithBLOBs.setStatus("error");
apiTestCaseMapper.updateByPrimaryKey(caseWithBLOBs);
MessageCache.batchTestCases.remove(request.getReportId());
LogUtil.error(ex.getMessage(), ex);
}
}