fix(测试跟踪): 测试计划失败用例TOP10无数据

--bug=1010277 --user=lyh 【测试跟踪】+【接口测试】github#10501v1.17.2 测试跟踪 和 接口测试
模块首页的 失败用例TOP10 无数据 https://www.tapd.cn/55049933/s/1105255

Closes #10501
This commit is contained in:
shiziyuan9527 2022-02-17 17:25:51 +08:00 committed by 刘瑞斌
parent d6a494c891
commit 28deabd68f
3 changed files with 10 additions and 12 deletions

View File

@ -37,13 +37,12 @@
-- api_test_case 只查找测试计划执行的结果 -- api_test_case 只查找测试计划执行的结果
SELECT testCase.testCaseID AS testCaseID,testCase.id AS id,testCase.testCaseName AS caseName,testCase.testPlanName AS testPlan ,caseErrorCountData.dataCountNumber AS failureTimes,'apiCase' AS caseType SELECT testCase.testCaseID AS testCaseID,testCase.id AS id,testCase.testCaseName AS caseName,testCase.testPlanName AS testPlan ,caseErrorCountData.dataCountNumber AS failureTimes,'apiCase' AS caseType
FROM ( FROM (
SELECT testPlanCase.id AS testCaseID,apiCase.id AS id,apiCase.`name` AS testCaseName,group_concat(testPlan.`name`) AS testPlanName, testPlanCase.update_time as updateTime SELECT testPlanCase.id AS testPlanCaseID, testPlanCase.api_case_id as testCaseID, apiCase.id AS id,apiCase.`name` AS testCaseName,testPlan.`name` AS testPlanName, testPlanCase.update_time as updateTime
FROM api_test_case apiCase FROM api_test_case apiCase
inner join api_definition on api_definition.id = apiCase.api_definition_id inner join api_definition on api_definition.id = apiCase.api_definition_id
INNER JOIN test_plan_api_case testPlanCase ON testPlanCase.api_case_id = apiCase.id INNER JOIN test_plan_api_case testPlanCase ON testPlanCase.api_case_id = apiCase.id
INNER JOIN test_plan testPlan ON testPlan.id = testPlanCase.test_plan_id INNER JOIN test_plan testPlan ON testPlan.id = testPlanCase.test_plan_id
and api_definition.status != 'Trash' and api_definition.status != 'Trash'
GROUP BY apiCase.id
ORDER BY apiCase.create_time DESC ORDER BY apiCase.create_time DESC
)testCase )testCase
INNER JOIN ( INNER JOIN (
@ -53,12 +52,11 @@
INNER JOIN test_plan_api_case t2 ON t1.id = t2.api_case_id INNER JOIN test_plan_api_case t2 ON t1.id = t2.api_case_id
WHERE t1.project_id = #{projectId} WHERE t1.project_id = #{projectId}
) and `status` = 'error' GROUP BY resource_id ) and `status` = 'error' GROUP BY resource_id
) caseErrorCountData ON caseErrorCountData.testPlanCaseID =testCase.testCaseID ) caseErrorCountData ON caseErrorCountData.testPlanCaseID =testCase.testPlanCaseID
WHERE testCase.updateTime >= #{startTimestamp} WHERE testCase.updateTime >= #{startTimestamp}
UNION UNION
SELECT scene.id AS testCaseID,scene.id AS id,scene.`name` AS caseName,apiScene.testPlanName AS testPlan,count(report.id) AS failureTimes,'scenario' AS caseType SELECT scene.id AS testCaseID,scene.id AS id,scene.`name` AS caseName,apiScene.testPlanName AS testPlan,count(report.id) AS failureTimes,'scenario' AS caseType
FROM api_scenario_report report FROM api_scenario_report report
INNER JOIN api_scenario_report_detail reportDetail ON report.id = reportDetail.report_id
INNER JOIN api_scenario scene ON report.scenario_id = scene.id INNER JOIN api_scenario scene ON report.scenario_id = scene.id
INNER JOIN( INNER JOIN(
SELECT apiScene.api_scenario_id, group_concat(testPlan.`name`) AS testPlanName SELECT apiScene.api_scenario_id, group_concat(testPlan.`name`) AS testPlanName

View File

@ -16,15 +16,15 @@
width="150" width="150"
show-overflow-tooltip> show-overflow-tooltip>
<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')"/> <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')">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<div v-for="(testPlan, index) in row.testPlanDTOList" :key="index"> <div v-for="(testPlan, index) in row.testPlanDTOList" :key="index">
<el-link type="info" @click="redirect('testPlanEdit',testPlan.id)"> <el-link type="info" @click="redirect('testPlanEdit',testPlan.id)" v-if="testPlan.name === row.testPlan">
{{ testPlan.name }}; {{ testPlan.name }};
</el-link> </el-link>
</div> </div>

View File

@ -21,15 +21,15 @@
width="150" width="150"
show-overflow-tooltip> show-overflow-tooltip>
<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')"/> <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')">
<template v-slot:default="{row}"> <template v-slot:default="{row}">
<div v-for="(testPlan, index) in row.testPlanDTOList" :key="index"> <div v-for="(testPlan, index) in row.testPlanDTOList" :key="index">
<el-link type="info" @click="redirect('testPlanEdit',testPlan.id)"> <el-link type="info" @click="redirect('testPlanEdit',testPlan.id)" v-if="testPlan.name === row.testPlan">
{{ testPlan.name }}; {{ testPlan.name }};
</el-link> </el-link>
</div> </div>