fix(测试跟踪): 首页失败用例列表未统计性能失败用例

This commit is contained in:
shiziyuan9527 2021-03-21 12:03:36 +08:00
parent f3eb82c839
commit 6c0780e1cb
8 changed files with 23 additions and 0 deletions

View File

@ -193,6 +193,8 @@ public class ApiDefinitionExecResultService {
planRequest.setScenarioId(item.getTestCaseID()); planRequest.setScenarioId(item.getTestCaseID());
} else if ("apiCase".equals(item.getCaseType())) { } else if ("apiCase".equals(item.getCaseType())) {
planRequest.setApiId(item.getTestCaseID()); planRequest.setApiId(item.getTestCaseID());
} else if ("load".equals(item.getCaseType())) {
planRequest.setLoadId(item.getTestCaseID());
} }
List<TestPlanDTO> dtoList = testPlanService.selectTestPlanByRelevancy(planRequest); List<TestPlanDTO> dtoList = testPlanService.selectTestPlanByRelevancy(planRequest);
item.setTestPlanDTOList(dtoList); item.setTestPlanDTOList(dtoList);

View File

@ -63,6 +63,18 @@
WHERE report.project_id = #{projectId} WHERE report.project_id = #{projectId}
AND ( report.STATUS = 'Error' OR report.STATUS = 'Fail' ) AND report.create_time >= #{startTimestamp} AND ( report.STATUS = 'Error' OR report.STATUS = 'Fail' ) AND report.create_time >= #{startTimestamp}
GROUP BY scene.id GROUP BY scene.id
UNION
SELECT ltr.test_id as testCaseID, ltr.name as caseName,tplt.testPlanName AS testPlan, count(ltr.id) as failureTimes, 'load' as caseType FROM load_test_report ltr
join load_test on load_test.id = ltr.test_id
JOIN (
select tplc.load_case_id, group_concat(tp.`name`) AS testPlanName, tp.project_id
from test_plan_load_case tplc
join test_plan tp on tp.id = tplc.test_plan_id
GROUP BY tplc.load_case_id
) tplt on tplt.load_case_id = ltr.test_id
WHERE load_test.project_id = #{projectId}
AND ltr.STATUS = 'Error' and ltr.trigger_mode = 'TEST_PLAN_SCHEDULE' AND ltr.create_time >= #{startTimestamp}
GROUP BY load_test.id
) showTable ) showTable
ORDER BY showTable.failureTimes DESC ORDER BY showTable.failureTimes DESC
</select> </select>

View File

@ -223,6 +223,9 @@
<if test="request.apiId != null"> <if test="request.apiId != null">
AND p.id IN (SELECT test_plan_id FROM test_plan_api_case WHERE api_case_id = #{request.apiId}) AND p.id IN (SELECT test_plan_id FROM test_plan_api_case WHERE api_case_id = #{request.apiId})
</if> </if>
<if test="request.loadId != null">
AND p.id IN (SELECT test_plan_id FROM test_plan_load_case WHERE load_case_id = #{request.loadId})
</if>
</where> </where>
</select> </select>
<select id="findTestProjectNameByTestPlanID" resultType="java.lang.String"> <select id="findTestProjectNameByTestPlanID" resultType="java.lang.String">

View File

@ -20,6 +20,8 @@ public class QueryTestPlanRequest extends TestPlan {
private String apiId; private String apiId;
private String loadId;
private List<OrderRequest> orders; private List<OrderRequest> orders;
private Map<String, List<String>> filters; private Map<String, List<String>> filters;

View File

@ -23,6 +23,7 @@
<template v-slot:default="scope"> <template v-slot:default="scope">
<ms-tag v-if="scope.row.caseType == 'apiCase'" type="success" effect="plain" :content="$t('api_test.home_page.failed_case_list.table_value.case_type.api')"/> <ms-tag v-if="scope.row.caseType == 'apiCase'" type="success" effect="plain" :content="$t('api_test.home_page.failed_case_list.table_value.case_type.api')"/>
<ms-tag v-if="scope.row.caseType == 'scenario'" type="warning" effect="plain" :content="$t('api_test.home_page.failed_case_list.table_value.case_type.scene')"/> <ms-tag v-if="scope.row.caseType == 'scenario'" type="warning" effect="plain" :content="$t('api_test.home_page.failed_case_list.table_value.case_type.scene')"/>
<ms-tag v-if="scope.row.caseType == 'load'" type="danger" effect="plain" :content="$t('api_test.home_page.failed_case_list.table_value.case_type.load')"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="testPlan" :label="$t('api_test.home_page.failed_case_list.table_coloum.test_plan')"> <el-table-column prop="testPlan" :label="$t('api_test.home_page.failed_case_list.table_coloum.test_plan')">

View File

@ -1035,6 +1035,7 @@ export default {
case_type: { case_type: {
api: "Api case", api: "Api case",
scene: "Scenario case", scene: "Scenario case",
load: "Load case"
} }
} }
}, },

View File

@ -1039,6 +1039,7 @@ export default {
case_type: { case_type: {
api: "接口用例", api: "接口用例",
scene: "场景用例", scene: "场景用例",
load: "性能用例"
} }
} }
}, },

View File

@ -1037,6 +1037,7 @@ export default {
case_type: { case_type: {
api: "接口用例", api: "接口用例",
scene: "場景用例", scene: "場景用例",
load: "性能用例"
} }
} }
}, },