feat(测试计划): 补充更新用例表状态逻辑
This commit is contained in:
parent
593554a6a1
commit
1d3331f5ff
|
@ -386,6 +386,10 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
functionalCase.setId(request.getId());
|
functionalCase.setId(request.getId());
|
||||||
testPlanFunctionalCaseMapper.updateByPrimaryKeySelective(functionalCase);
|
testPlanFunctionalCaseMapper.updateByPrimaryKeySelective(functionalCase);
|
||||||
|
|
||||||
|
//更新用例表执行状态
|
||||||
|
updateFunctionalCaseStatus(Arrays.asList(request.getCaseId()), request.getLastExecResult());
|
||||||
|
|
||||||
|
|
||||||
//执行记录
|
//执行记录
|
||||||
TestPlanCaseExecuteHistory executeHistory = buildHistory(request, logInsertModule.getOperator());
|
TestPlanCaseExecuteHistory executeHistory = buildHistory(request, logInsertModule.getOperator());
|
||||||
testPlanCaseExecuteHistoryMapper.insert(executeHistory);
|
testPlanCaseExecuteHistoryMapper.insert(executeHistory);
|
||||||
|
@ -396,6 +400,25 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
operationLogService.batchAdd(logDTOList);
|
operationLogService.batchAdd(logDTOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新功能用例表的执行状态
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @param lastExecResult
|
||||||
|
*/
|
||||||
|
private void updateFunctionalCaseStatus(List<String> ids, String lastExecResult) {
|
||||||
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
|
FunctionalCaseMapper functionalCaseMapper = sqlSession.getMapper(FunctionalCaseMapper.class);
|
||||||
|
ids.forEach(id -> {
|
||||||
|
FunctionalCase functionalCase = new FunctionalCase();
|
||||||
|
functionalCase.setId(id);
|
||||||
|
functionalCase.setLastExecuteResult(lastExecResult);
|
||||||
|
functionalCaseMapper.updateByPrimaryKeySelective(functionalCase);
|
||||||
|
});
|
||||||
|
sqlSession.flushStatements();
|
||||||
|
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private TestPlanCaseExecuteHistory buildHistory(TestPlanCaseRunRequest request, String operator) {
|
private TestPlanCaseExecuteHistory buildHistory(TestPlanCaseRunRequest request, String operator) {
|
||||||
TestPlanCaseExecuteHistory executeHistory = new TestPlanCaseExecuteHistory();
|
TestPlanCaseExecuteHistory executeHistory = new TestPlanCaseExecuteHistory();
|
||||||
|
@ -444,6 +467,8 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
List<TestPlanCaseExecuteHistory> historyList = getExecHistory(ids, request, logInsertModule, idsMap);
|
List<TestPlanCaseExecuteHistory> historyList = getExecHistory(ids, request, logInsertModule, idsMap);
|
||||||
testPlanCaseExecuteHistoryMapper.batchInsert(historyList);
|
testPlanCaseExecuteHistoryMapper.batchInsert(historyList);
|
||||||
|
|
||||||
|
updateFunctionalCaseStatus(caseIds, request.getLastExecResult());
|
||||||
|
|
||||||
List<LogDTO> logDTOList = runLog(idsMap, caseIds, request.getProjectId(), organizationId, new ResourceLogInsertModule(TestPlanResourceConstants.RESOURCE_FUNCTIONAL_CASE, logInsertModule));
|
List<LogDTO> logDTOList = runLog(idsMap, caseIds, request.getProjectId(), organizationId, new ResourceLogInsertModule(TestPlanResourceConstants.RESOURCE_FUNCTIONAL_CASE, logInsertModule));
|
||||||
operationLogService.batchAdd(logDTOList);
|
operationLogService.batchAdd(logDTOList);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue