fix(测试计划): 修复测试计划进度条不准确

This commit is contained in:
shiziyuan9527 2021-01-25 17:09:32 +08:00
parent 465fcc85c5
commit b0ff13917c
2 changed files with 15 additions and 1 deletions

View File

@ -139,4 +139,8 @@ public class TestPlanLoadCaseService {
testPlanLoadCaseMapper.updateByPrimaryKeySelective(testPlanLoadCase);
}
}
public List<String> getStatus(String planId) {
return extTestPlanLoadCaseMapper.getStatusByTestPlanId(planId);
}
}

View File

@ -382,7 +382,17 @@ public class TestPlanService {
}
});
testPlan.setTotal(apiExecResults.size() + scenarioExecResults.size() + functionalExecResults.size());
List<String> loadResults = testPlanLoadCaseService.getStatus(testPlan.getId());
loadResults.forEach(item -> {
if (StringUtils.isNotBlank(item)) {
testPlan.setTested(testPlan.getTested() + 1);
if (StringUtils.equals(item, "success")) {
testPlan.setPassed(testPlan.getPassed() + 1);
}
}
});
testPlan.setTotal(apiExecResults.size() + scenarioExecResults.size() + functionalExecResults.size() + loadResults.size());
testPlan.setPassRate(MathUtils.getPercentWithDecimal(testPlan.getTested() == 0 ? 0 : testPlan.getPassed() * 1.0 / testPlan.getTested()));
testPlan.setTestRate(MathUtils.getPercentWithDecimal(testPlan.getTotal() == 0 ? 0 : testPlan.getTested() * 1.0 / testPlan.getTotal()));