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

View File

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

View File

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

View File

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