fix(测试计划): 修复测试计划里面单独执行接口用例时接口用例列表的最终执行结果没更新的问题

--bug=1018867 --user=宋天阳 【测试跟踪】测试计划-接口用例和场景用例列表中执行用例,在接口测试模块的测试报告中仍能看见报告
https://www.tapd.cn/55049933/s/1276700
This commit is contained in:
song-tianyang 2022-10-25 18:39:45 +08:00 committed by 建国
parent beaff1b33a
commit b818366cd9
1 changed files with 15 additions and 0 deletions

View File

@ -102,6 +102,15 @@ public class ApiDefinitionExecResultService {
result.setUserId(dto.getExtendedParameters().get("userId").toString());
}
}
//如果是测试计划用例更新接口用例的上次执行结果
TestPlanApiCase testPlanApiCase = testPlanApiCaseMapper.selectByPrimaryKey(dto.getTestId());
if (testPlanApiCase != null) {
ApiTestCaseWithBLOBs apiTestCase = apiTestCaseMapper.selectByPrimaryKey(testPlanApiCase.getApiCaseId());
if (apiTestCase != null) {
apiTestCase.setLastResultId(dto.getReportId());
apiTestCaseMapper.updateByPrimaryKeySelective(apiTestCase);
}
}
// 发送通知
LoggerUtil.info("执行结果【 " + result.getName() + " 】入库存储完成");
sendNotice(result, user);
@ -296,6 +305,12 @@ public class ApiDefinitionExecResultService {
apiCase.setStatus(status);
apiCase.setUpdateTime(System.currentTimeMillis());
testPlanApiCaseMapper.updateByPrimaryKeySelective(apiCase);
ApiTestCaseWithBLOBs apiTestCase = apiTestCaseMapper.selectByPrimaryKey(apiCase.getApiCaseId());
if (apiTestCase != null) {
apiTestCase.setLastResultId(dto.getReportId());
apiTestCaseMapper.updateByPrimaryKeySelective(apiTestCase);
}
}
} else {
this.setExecResult(dto.getTestId(), status, item.getStartTime());