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) { public TestPlanReport genTestPlanReport(TestPlanReportSaveRequest saveRequest) {
TestPlan testPlan = testPlanMapper.selectByPrimaryKey(saveRequest.getPlanId()); TestPlan testPlan = testPlanMapper.selectByPrimaryKey(saveRequest.getPlanId());
testPlan.setExecutionTimes(1);
testPlan.setExecutionTimes(testPlan.getExecutionTimes() + 1);
testPlanMapper.updateByPrimaryKey(testPlan);
String testPlanReportID = saveRequest.getReportID(); String testPlanReportID = saveRequest.getReportID();
TestPlanReport testPlanReport = new TestPlanReport(); TestPlanReport testPlanReport = new TestPlanReport();
testPlanReport.setTestPlanId(saveRequest.getPlanId()); testPlanReport.setTestPlanId(saveRequest.getPlanId());

View File

@ -122,7 +122,7 @@ public class TestPlanService {
@Resource @Resource
private ApiDefinitionMapper apiDefinitionMapper; private ApiDefinitionMapper apiDefinitionMapper;
@Resource @Resource
private TestPlanApiCaseMapper testPlanApiCaseMapper; private TestPlanApiCaseMapper testPlanApiCaseMapper;
@Resource @Resource
private TestPlanApiScenarioMapper testPlanApiScenarioMapper; private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
@Resource @Resource
@ -131,6 +131,8 @@ public class TestPlanService {
private TestCaseTestMapper testCaseTestMapper; private TestCaseTestMapper testCaseTestMapper;
@Resource @Resource
private ApiScenarioReportMapper apiScenarioReportMapper; private ApiScenarioReportMapper apiScenarioReportMapper;
@Resource
private TestPlanReportMapper testPlanReportMapper;
public synchronized String addTestPlan(AddTestPlanRequest testPlan) { public synchronized String addTestPlan(AddTestPlanRequest testPlan) {
if (getTestPlanByName(testPlan.getName()).size() > 0) { if (getTestPlanByName(testPlan.getName()).size() > 0) {
@ -385,6 +387,11 @@ public class TestPlanService {
request.setProjectId(projectId); request.setProjectId(projectId);
} }
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.list(request); 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); calcTestPlanRate(testPlans);
return testPlans; return testPlans;
} }