fix(场景测试报告,功能案例导入,场景测试-导入街口): 修复场景测试报告在多条名称相同的SQL请求下步骤统计错误的问题,修复测试用例同一模块下用例可以重复导入的问题,修复场景导入接口时鼠标悬停在ID上弹出编辑气泡的问题

修复场景测试报告在多条名称相同的SQL请求下步骤统计错误的问题,修复测试用例同一模块下用例可以重复导入的问题,修复场景导入接口时鼠标悬停在ID上弹出编辑气泡的问题
This commit is contained in:
song-tianyang 2021-06-30 11:35:23 +08:00 committed by 刘瑞斌
parent ece5c35c1a
commit f96bf64341
5 changed files with 76 additions and 48 deletions

View File

@ -7,10 +7,7 @@ import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@Data
public class TestResult {
@ -112,8 +109,8 @@ public class TestResult {
this.setStatus(scenarioNames.toString(), item.getError() > 0);
itemAndScenarioName = scenarioNames.toString();
}else{
//不存在多场景时需要补上步骤名字做唯一判断
itemAndScenarioName = item.getName()+":"+JSONArray.toJSONString(all_id_names.get(0));
//不存在多场景时需要补上步骤名字做唯一判断 添加UUID进行处理
itemAndScenarioName = item.getName()+":"+JSONArray.toJSONString(all_id_names.get(0))+ UUID.randomUUID().toString();
this.setStatus(all_id_names, item.getError() > 0);
}

View File

@ -168,8 +168,39 @@ public class TestCaseDataIgnoreErrorListener extends EasyExcelListener<TestCaseE
}
}
}
/*
校验用例
*/
if (testCaseNames.contains(data.getName())) {
TestCaseWithBLOBs testCase = new TestCaseWithBLOBs();
BeanUtils.copyBean(testCase, data);
testCase.setProjectId(projectId);
String steps = getSteps(data);
testCase.setSteps(steps);
testCase.setType("functional");
boolean dbExist = testCaseService.exist(testCase);
boolean excelExist = false;
if (dbExist) {
// db exist
stringBuilder.append(Translator.get("test_case_already_exists") + "" + data.getName() + "; ");
} else {
// @Data 重写了 equals hashCode 方法
excelExist = excelDataList.contains(data);
}
if (excelExist) {
// excel exist
stringBuilder.append(Translator.get("test_case_already_exists_excel") + "" + data.getName() + "; ");
} else {
excelDataList.add(data);
}
} else {
testCaseNames.add(data.getName());
excelDataList.add(data);
}
return stringBuilder.toString();
}

View File

@ -158,36 +158,36 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
/*
校验用例
*/
// if (testCaseNames.contains(data.getName())) {
// TestCaseWithBLOBs testCase = new TestCaseWithBLOBs();
// BeanUtils.copyBean(testCase, data);
// testCase.setProjectId(projectId);
// String steps = getSteps(data);
// testCase.setSteps(steps);
// testCase.setType("functional");
//
// boolean dbExist = testCaseService.exist(testCase);
// boolean excelExist = false;
//
// if (dbExist) {
// // db exist
// stringBuilder.append(Translator.get("test_case_already_exists") + "" + data.getName() + "; ");
// } else {
// // @Data 重写了 equals hashCode 方法
// excelExist = excelDataList.contains(data);
// }
//
// if (excelExist) {
// // excel exist
// stringBuilder.append(Translator.get("test_case_already_exists_excel") + "" + data.getName() + "; ");
// } else {
// excelDataList.add(data);
// }
//
// } else {
if (testCaseNames.contains(data.getName())) {
TestCaseWithBLOBs testCase = new TestCaseWithBLOBs();
BeanUtils.copyBean(testCase, data);
testCase.setProjectId(projectId);
String steps = getSteps(data);
testCase.setSteps(steps);
testCase.setType("functional");
boolean dbExist = testCaseService.exist(testCase);
boolean excelExist = false;
if (dbExist) {
// db exist
stringBuilder.append(Translator.get("test_case_already_exists") + "" + data.getName() + "; ");
} else {
// @Data 重写了 equals hashCode 方法
excelExist = excelDataList.contains(data);
}
if (excelExist) {
// excel exist
stringBuilder.append(Translator.get("test_case_already_exists_excel") + "" + data.getName() + "; ");
} else {
excelDataList.add(data);
}
} else {
testCaseNames.add(data.getName());
excelDataList.add(data);
// }
}
return stringBuilder.toString();
}

View File

@ -22,13 +22,13 @@
label="ID"
min-width="80px"
sortable>
<template slot-scope="scope">
<!-- 判断为只读用户的话不可点击ID进行编辑操作 -->
<span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.num }} </span>
<el-tooltip v-else content="编辑">
<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>
</el-tooltip>
</template>
<!-- <template slot-scope="scope">-->
<!-- &lt;!&ndash; 判断为只读用户的话不可点击ID进行编辑操作 &ndash;&gt;-->
<!-- <span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.num }} </span>-->
<!-- <el-tooltip v-else content="编辑">-->
<!-- <a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>-->
<!-- </el-tooltip>-->
<!-- </template>-->
</ms-table-column>
<ms-table-column
prop="name"

View File

@ -23,13 +23,13 @@
label="ID"
width="80px"
sortable=true>
<template slot-scope="scope">
<!-- 判断为只读用户的话不可点击ID进行编辑操作 -->
<span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.num }} </span>
<el-tooltip v-else content="编辑">
<a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>
</el-tooltip>
</template>
<!-- <template slot-scope="scope">-->
<!-- &lt;!&ndash; 判断为只读用户的话不可点击ID进行编辑操作 &ndash;&gt;-->
<!-- <span style="cursor:pointer" v-if="isReadOnly"> {{ scope.row.num }} </span>-->
<!-- <el-tooltip v-else content="编辑">-->
<!-- <a style="cursor:pointer" @click="editApi(scope.row)"> {{ scope.row.num }} </a>-->
<!-- </el-tooltip>-->
<!-- </template>-->
</ms-table-column>
<ms-table-column prop="name" width="160px" :label="$t('test_track.case.name')"/>