Merge branch 'v1.8' of https://github.com/metersphere/metersphere into v1.8
This commit is contained in:
commit
a555ddd334
|
@ -19,6 +19,7 @@ import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
||||||
|
|
||||||
|
@ -151,6 +152,7 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
||||||
.map(item -> this.convert2TestCase(item))
|
.map(item -> this.convert2TestCase(item))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
testCaseService.saveImportData(result, projectId);
|
testCaseService.saveImportData(result, projectId);
|
||||||
|
this.isUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(updateList.size() == 0)) {
|
if (!(updateList.size() == 0)) {
|
||||||
|
@ -180,9 +182,11 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
||||||
if (nodePath.endsWith("/")) {
|
if (nodePath.endsWith("/")) {
|
||||||
nodePath = nodePath.substring(0, nodePath.length() - 1);
|
nodePath = nodePath.substring(0, nodePath.length() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
testCase.setNodePath(nodePath);
|
testCase.setNodePath(nodePath);
|
||||||
|
|
||||||
|
//将标签设置为前端可解析的格式
|
||||||
|
String modifiedTags = modifyTagPattern(data);
|
||||||
|
testCase.setTags(modifiedTags);
|
||||||
|
|
||||||
String steps = getSteps(data);
|
String steps = getSteps(data);
|
||||||
testCase.setSteps(steps);
|
testCase.setSteps(steps);
|
||||||
|
@ -201,6 +205,7 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
||||||
testCase.setProjectId(this.projectId);
|
testCase.setProjectId(this.projectId);
|
||||||
testCase.setUpdateTime(System.currentTimeMillis());
|
testCase.setUpdateTime(System.currentTimeMillis());
|
||||||
|
|
||||||
|
//调整nodePath格式
|
||||||
String nodePath = data.getNodePath();
|
String nodePath = data.getNodePath();
|
||||||
if (!nodePath.startsWith("/")) {
|
if (!nodePath.startsWith("/")) {
|
||||||
nodePath = "/" + nodePath;
|
nodePath = "/" + nodePath;
|
||||||
|
@ -213,9 +218,32 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
||||||
String steps = getSteps(data);
|
String steps = getSteps(data);
|
||||||
testCase.setSteps(steps);
|
testCase.setSteps(steps);
|
||||||
|
|
||||||
|
//将标签设置为前端可解析的格式
|
||||||
|
String modifiedTags = modifyTagPattern(data);
|
||||||
|
testCase.setTags(modifiedTags);
|
||||||
|
|
||||||
return testCase;
|
return testCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调整tags格式,便于前端进行解析。
|
||||||
|
* 例如对于:标签1,标签2。将调整为:["标签1","标签2"]。
|
||||||
|
*/
|
||||||
|
public String modifyTagPattern(TestCaseExcelData data){
|
||||||
|
String tags = data.getTags();
|
||||||
|
if (tags != null) {
|
||||||
|
Stream<String> stringStream = Arrays.stream(tags.split("[,;,;]")); //当标签值以中英文的逗号和分号分隔时才能正确解析
|
||||||
|
List<String> tagList = stringStream.map(tag -> tag = "\"" + tag + "\"")
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
String modifiedTags = StringUtils.join(tagList, ",");
|
||||||
|
modifiedTags = "[" + modifiedTags + "]";
|
||||||
|
return modifiedTags;
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getSteps(TestCaseExcelData data) {
|
public String getSteps(TestCaseExcelData data) {
|
||||||
JSONArray jsonArray = new JSONArray();
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
|
||||||
|
|
|
@ -451,7 +451,7 @@ public class TestCaseService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 把Excel中带ID的数据更新到数据库
|
* 把Excel中带ID的数据更新到数据库
|
||||||
*
|
* feat(测试跟踪):通过Excel导入导出时有ID字段,可通过Excel导入来更新用例。 (#1727)
|
||||||
* @param testCases
|
* @param testCases
|
||||||
* @param projectId
|
* @param projectId
|
||||||
*/
|
*/
|
||||||
|
@ -556,9 +556,10 @@ public class TestCaseService {
|
||||||
|
|
||||||
list.add(new TestCaseExcelData());
|
list.add(new TestCaseExcelData());
|
||||||
TestCaseExcelData explain = new TestCaseExcelData();
|
TestCaseExcelData explain = new TestCaseExcelData();
|
||||||
explain.setName(Translator.get("do_not_modify_header_order"));
|
explain.setName(Translator.get("do_not_modify_header_order") + "," + Translator.get("num_needed_modify_testcase") + "," + Translator.get("num_needless_create_testcase"));
|
||||||
explain.setNodePath(Translator.get("module_created_automatically"));
|
explain.setNodePath(Translator.get("module_created_automatically"));
|
||||||
explain.setType(Translator.get("options") + "(functional、performance、api)");
|
explain.setType(Translator.get("options") + "(functional、performance、api)");
|
||||||
|
explain.setTags(Translator.get("tag_tip_pattern"));
|
||||||
// explain.setMethod(Translator.get("options") + "(manual、auto)");
|
// explain.setMethod(Translator.get("options") + "(manual、auto)");
|
||||||
explain.setPriority(Translator.get("options") + "(P0、P1、P2、P3)");
|
explain.setPriority(Translator.get("options") + "(P0、P1、P2、P3)");
|
||||||
explain.setMaintainer(Translator.get("please_input_workspace_member"));
|
explain.setMaintainer(Translator.get("please_input_workspace_member"));
|
||||||
|
|
|
@ -126,6 +126,9 @@ test_manager=Test manager
|
||||||
tester=Tester
|
tester=Tester
|
||||||
read_only_user=Read-only user
|
read_only_user=Read-only user
|
||||||
module=Module
|
module=Module
|
||||||
|
num_needed_modify_testcase=ID is needed when modifying testcase
|
||||||
|
num_needless_create_testcase=ID is needless when creating testcase
|
||||||
|
tag_tip_pattern=Labels should be separated by semicolons or commas
|
||||||
preconditions_optional=Preconditions optional
|
preconditions_optional=Preconditions optional
|
||||||
step_tip_separate=Each step is separated by a new line
|
step_tip_separate=Each step is separated by a new line
|
||||||
step_tip_order=The serial number can be marked before the step
|
step_tip_order=The serial number can be marked before the step
|
||||||
|
|
|
@ -126,6 +126,9 @@ test_manager=测试经理
|
||||||
tester=测试成员
|
tester=测试成员
|
||||||
read_only_user=只读用户
|
read_only_user=只读用户
|
||||||
module=模块
|
module=模块
|
||||||
|
num_needed_modify_testcase=修改用例时ID必填
|
||||||
|
num_needless_create_testcase=创建用例时无需ID
|
||||||
|
tag_tip_pattern=标签之间以分号或者逗号隔开
|
||||||
preconditions_optional=前置条件选填
|
preconditions_optional=前置条件选填
|
||||||
step_tip_separate=每个步骤以换行分隔
|
step_tip_separate=每个步骤以换行分隔
|
||||||
step_tip_order=步骤前可标序号
|
step_tip_order=步骤前可标序号
|
||||||
|
|
|
@ -126,6 +126,9 @@ test_manager=測試經理
|
||||||
tester=測試成員
|
tester=測試成員
|
||||||
read_only_user=只讀用戶
|
read_only_user=只讀用戶
|
||||||
module=模塊
|
module=模塊
|
||||||
|
num_needed_modify_testcase=修改用例時ID必填
|
||||||
|
num_needless_create_testcase=創建用例時無需ID
|
||||||
|
tag_tip_pattern=標籤之間以分號或者逗號隔開
|
||||||
preconditions_optional=前置條件選填
|
preconditions_optional=前置條件選填
|
||||||
step_tip_separate=每個步驟以換行分隔
|
step_tip_separate=每個步驟以換行分隔
|
||||||
step_tip_order=步驟前可標序號
|
step_tip_order=步驟前可標序號
|
||||||
|
|
Loading…
Reference in New Issue