fix(测试跟踪): 测试跟踪,测试计划列表标签和执行次数显示错误

This commit is contained in:
wenyann 2021-04-01 17:32:44 +08:00 committed by BugKing
parent 4965645549
commit 4ed5027367
2 changed files with 8 additions and 5 deletions

View File

@ -88,10 +88,6 @@ public class TestPlanReportService {
*/
public TestPlanReport genTestPlanReport(TestPlanReportSaveRequest saveRequest) {
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(saveRequest.getPlanId());
testPlan.setExecutionTimes(1);
testPlan.setExecutionTimes(testPlan.getExecutionTimes() + 1);
testPlanMapper.updateByPrimaryKey(testPlan);
String testPlanReportID = saveRequest.getReportID();
TestPlanReport testPlanReport = new TestPlanReport();
testPlanReport.setTestPlanId(saveRequest.getPlanId());

View File

@ -122,7 +122,7 @@ public class TestPlanService {
@Resource
private ApiDefinitionMapper apiDefinitionMapper;
@Resource
private TestPlanApiCaseMapper testPlanApiCaseMapper;
private TestPlanApiCaseMapper testPlanApiCaseMapper;
@Resource
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
@Resource
@ -131,6 +131,8 @@ public class TestPlanService {
private TestCaseTestMapper testCaseTestMapper;
@Resource
private ApiScenarioReportMapper apiScenarioReportMapper;
@Resource
private TestPlanReportMapper testPlanReportMapper;
public synchronized String addTestPlan(AddTestPlanRequest testPlan) {
if (getTestPlanByName(testPlan.getName()).size() > 0) {
@ -385,6 +387,11 @@ public class TestPlanService {
request.setProjectId(projectId);
}
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.list(request);
testPlans.forEach(item -> {
TestPlanReportExample example = new TestPlanReportExample();
example.createCriteria().andTestPlanIdEqualTo(item.getId());
item.setExecutionTimes((int) testPlanReportMapper.countByExample(example));
});
calcTestPlanRate(testPlans);
return testPlans;
}