fix(测试跟踪首页、接口测试、接口自动化): 修复首页统计总数错误、转性能测试报错、列表跳转数据查询出错的问题 #1005697 #1005694 #1005686

--bug=1005697 --user=宋天阳 【测试跟踪】首页,用例总数统计有误
https://www.tapd.cn/55049933/s/1033262  --bug=1005694 --user=宋天阳
【接口自动化】包含前/后置sql的场景,转性能测试会报错 https://www.tapd.cn/55049933/s/1033263
--bug=1005686 --user=宋天阳 【接口定义】点击首页用例名称,跳转到用例列表后,用例列表数据清空了
https://www.tapd.cn/55049933/s/1033264
This commit is contained in:
song-tianyang 2021-08-06 17:33:56 +08:00 committed by 刘瑞斌
parent bcb29d816e
commit 6ddc5bf2e4
10 changed files with 17 additions and 11 deletions

View File

@ -332,6 +332,7 @@ public class APITestController {
dataDTO.setTestPlan(selectData.getTestPlan());
dataDTO.setFailureTimes(selectData.getFailureTimes());
dataDTO.setCaseType(selectData.getCaseType());
dataDTO.setId(selectData.getId());
dataDTO.setTestPlanDTOList(selectData.getTestPlanDTOList());
} else {
dataDTO.setCaseName("");

View File

@ -13,6 +13,7 @@ import java.util.List;
@Setter
public class ExecutedCaseInfoResult {
private String testCaseID;
private String id;
//案例名称
private String caseName;
//所属测试计划

View File

@ -22,8 +22,10 @@ public class ExecutedCaseInfoDTO {
private Long failureTimes;
//案例类型
private String caseType;
//案例ID
//案例ID -- 目前被用为案例-测试计划 关联表ID
private String caseID;
//ID
private String id;
//测试计划集合
private List<TestPlanDTO> testPlanDTOList;
}

View File

@ -236,7 +236,7 @@ public class MsJDBCPostProcessor extends MsTestElement {
private JDBCPostProcessor jdbcPostProcessor(ParameterConfig config) {
JDBCPostProcessor jdbcPostProcessor = new JDBCPostProcessor();
jdbcPostProcessor.setEnabled(this.isEnable());
jdbcPostProcessor.setName(this.getName());
jdbcPostProcessor.setName(this.getName() == null? "JDBCPostProcessor" : this.getName());
String name = this.getParentName(this.getParent());
if (StringUtils.isNotEmpty(name) && !config.isOperating()) {
jdbcPostProcessor.setName(this.getName() + DelimiterConstants.SEPARATOR.toString() + name);

View File

@ -236,7 +236,7 @@ public class MsJDBCPreProcessor extends MsTestElement {
private JDBCPreProcessor jdbcPreProcessor(ParameterConfig config) {
JDBCPreProcessor jdbcPreProcessor = new JDBCPreProcessor();
jdbcPreProcessor.setEnabled(this.isEnable());
jdbcPreProcessor.setName(this.getName());
jdbcPreProcessor.setName(this.getName() == null? "JDBCPreProcessor" : this.getName());
String name = this.getParentName(this.getParent());
if (StringUtils.isNotEmpty(name) && !config.isOperating()) {
jdbcPreProcessor.setName(this.getName() + DelimiterConstants.SEPARATOR.toString() + name);

View File

@ -34,9 +34,9 @@
<select id="findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber" resultType="io.metersphere.api.dto.datacount.ExecutedCaseInfoResult">
SELECT * FROM (
-- api_test_case 只查找测试计划执行的结果
SELECT testCase.testCaseID,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 (
SELECT testPlanCase.id AS testCaseID,apiCase.`name` AS testCaseName,group_concat(testPlan.`name`) AS testPlanName, testPlanCase.update_time as updateTime
SELECT testPlanCase.id AS testCaseID,apiCase.id AS id,apiCase.`name` AS testCaseName,group_concat(testPlan.`name`) AS testPlanName, testPlanCase.update_time as updateTime
FROM api_test_case apiCase
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
@ -55,7 +55,7 @@
) caseErrorCountData ON caseErrorCountData.testPlanCaseID =testCase.testCaseID
WHERE testCase.updateTime >= #{startTimestamp}
UNION
SELECT scene.id AS testCaseID,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
INNER JOIN api_scenario_report_detail reportDetail ON report.id = reportDetail.report_id
INNER JOIN api_scenario scene ON report.scenario_id = scene.id
@ -69,7 +69,7 @@
AND ( report.STATUS = 'Error' OR report.STATUS = 'Fail' ) AND report.create_time >= #{startTimestamp}
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
SELECT ltr.test_id as testCaseID,ltr.id AS id, 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

View File

@ -418,7 +418,7 @@
<select id="countProtocolByProjectID" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
SELECT apiDef.protocol AS groupField,COUNT(testCase.id) AS countNumber FROM api_test_case testCase
INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id
WHERE testCase.project_id = #{0} AND apiDef.status != "Trash"
WHERE testCase.project_id = #{0} AND (testCase.status IS NULL or testCase.status != "Trash")
GROUP BY apiDef.protocol
</select>
<select id="findApiUrlAndMethodById" resultType="io.metersphere.base.domain.ApiDefinition">

View File

@ -385,7 +385,9 @@
</sql>
<select id="countPriority" resultType="io.metersphere.track.response.TrackCountResult">
SELECT test_case.priority as groupField,count(id) AS countNumber FROM test_case WHERE project_id = #{projectId} GROUP BY test_case.priority
SELECT test_case.priority as groupField,count(id) AS countNumber FROM test_case
WHERE project_id = #{projectId} AND (test_case.status IS NULL OR test_case.status != 'Trash')
GROUP BY test_case.priority
</select>
<!-- todo 排除删除的用例统计-->

View File

@ -9,7 +9,7 @@
<el-table-column prop="sortIndex" :label="$t('api_test.home_page.failed_case_list.table_coloum.index')" width="100" show-overflow-tooltip/>
<el-table-column prop="caseName" :label="$t('api_test.home_page.failed_case_list.table_coloum.case_name')" width="150">
<template v-slot:default="{row}">
<el-link type="info" @click="redirect(row.caseType,row.caseID)">
<el-link type="info" @click="redirect(row.caseType,row.id)">
{{ row.caseName }}
</el-link>
</template>

View File

@ -15,7 +15,7 @@
</div>
</div>
<div>
<div class="editorsDivStyle">
<div class="editors_div_style">
<div id="editorsDiv" >
<mavon-editor v-if="showEditor" @imgAdd="imgAdd" :default-open="'edit'" class="review-mavon-editor" :imageFilter="imageFilter"
:toolbars="richDataToolbars" @imgDel="imgDel" v-model="textarea" ref="md"/>