refactor(测试计划): 测试计划功能用例详情的步骤结果对比增加唯一性
This commit is contained in:
parent
aa9101c795
commit
156bed16c9
|
@ -615,23 +615,22 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
String historyStepStr = new String(testPlanCaseExecuteHistory.getSteps(), StandardCharsets.UTF_8);
|
String historyStepStr = new String(testPlanCaseExecuteHistory.getSteps(), StandardCharsets.UTF_8);
|
||||||
if (StringUtils.isNotBlank(historyStepStr)) {
|
if (StringUtils.isNotBlank(historyStepStr)) {
|
||||||
List<FunctionalCaseStepDTO> historySteps = JSON.parseArray(historyStepStr, FunctionalCaseStepDTO.class);
|
List<FunctionalCaseStepDTO> historySteps = JSON.parseArray(historyStepStr, FunctionalCaseStepDTO.class);
|
||||||
|
Map<String, FunctionalCaseStepDTO> historyStepMap = historySteps.stream().collect(Collectors.toMap(FunctionalCaseStepDTO::getId, t -> t));
|
||||||
newCaseSteps.forEach(newCaseStep -> {
|
newCaseSteps.forEach(newCaseStep -> {
|
||||||
historySteps.forEach(historyStep -> {
|
setHistoryInfo(newCaseStep, historyStepMap);
|
||||||
setHistoryInfo(newCaseStep, historyStep);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setHistoryInfo(FunctionalCaseStepDTO newCaseStep, FunctionalCaseStepDTO historyStep) {
|
private static void setHistoryInfo(FunctionalCaseStepDTO newCaseStep, Map<String, FunctionalCaseStepDTO> historyStepMap) {
|
||||||
if (StringUtils.equals(historyStep.getDesc(), newCaseStep.getDesc()) && StringUtils.equals(historyStep.getResult(), newCaseStep.getResult())) {
|
FunctionalCaseStepDTO historyStep = historyStepMap.get(newCaseStep.getId());
|
||||||
|
if (historyStep != null && StringUtils.equals(historyStep.getDesc(), newCaseStep.getDesc()) && StringUtils.equals(historyStep.getResult(), newCaseStep.getResult())) {
|
||||||
newCaseStep.setExecuteResult(historyStep.getExecuteResult());
|
newCaseStep.setExecuteResult(historyStep.getExecuteResult());
|
||||||
newCaseStep.setActualResult(historyStep.getActualResult());
|
newCaseStep.setActualResult(historyStep.getActualResult());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void editFunctionalCase(TestPlanCaseEditRequest request, String userId) {
|
public void editFunctionalCase(TestPlanCaseEditRequest request, String userId) {
|
||||||
TestPlanFunctionalCase planFunctionalCase = testPlanFunctionalCaseMapper.selectByPrimaryKey(request.getId());
|
TestPlanFunctionalCase planFunctionalCase = testPlanFunctionalCaseMapper.selectByPrimaryKey(request.getId());
|
||||||
TestPlanFunctionalCase functionalCase = new TestPlanFunctionalCase();
|
TestPlanFunctionalCase functionalCase = new TestPlanFunctionalCase();
|
||||||
|
|
Loading…
Reference in New Issue