Merge branch 'master' of github.com:metersphere/metersphere
This commit is contained in:
commit
b0dbc6e240
|
@ -19,6 +19,7 @@ import java.util.*;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
||||
|
||||
|
@ -151,6 +152,7 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
.map(item -> this.convert2TestCase(item))
|
||||
.collect(Collectors.toList());
|
||||
testCaseService.saveImportData(result, projectId);
|
||||
this.isUpdated = true;
|
||||
}
|
||||
|
||||
if (!(updateList.size() == 0)) {
|
||||
|
@ -180,9 +182,11 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
if (nodePath.endsWith("/")) {
|
||||
nodePath = nodePath.substring(0, nodePath.length() - 1);
|
||||
}
|
||||
|
||||
testCase.setNodePath(nodePath);
|
||||
|
||||
//将标签设置为前端可解析的格式
|
||||
String modifiedTags = modifyTagPattern(data);
|
||||
testCase.setTags(modifiedTags);
|
||||
|
||||
String steps = getSteps(data);
|
||||
testCase.setSteps(steps);
|
||||
|
@ -201,6 +205,7 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
testCase.setProjectId(this.projectId);
|
||||
testCase.setUpdateTime(System.currentTimeMillis());
|
||||
|
||||
//调整nodePath格式
|
||||
String nodePath = data.getNodePath();
|
||||
if (!nodePath.startsWith("/")) {
|
||||
nodePath = "/" + nodePath;
|
||||
|
@ -213,9 +218,32 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
String steps = getSteps(data);
|
||||
testCase.setSteps(steps);
|
||||
|
||||
//将标签设置为前端可解析的格式
|
||||
String modifiedTags = modifyTagPattern(data);
|
||||
testCase.setTags(modifiedTags);
|
||||
|
||||
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) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
|
||||
|
|
|
@ -547,9 +547,10 @@ public class TestCaseService {
|
|||
|
||||
list.add(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.setType(Translator.get("options") + "(functional、performance、api)");
|
||||
explain.setTags(Translator.get("tag_tip_pattern"));
|
||||
// explain.setMethod(Translator.get("options") + "(manual、auto)");
|
||||
explain.setPriority(Translator.get("options") + "(P0、P1、P2、P3)");
|
||||
explain.setMaintainer(Translator.get("please_input_workspace_member"));
|
||||
|
|
|
@ -125,6 +125,9 @@ test_manager=Test manager
|
|||
tester=Tester
|
||||
read_only_user=Read-only user
|
||||
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
|
||||
step_tip_separate=Each step is separated by a new line
|
||||
step_tip_order=The serial number can be marked before the step
|
||||
|
|
|
@ -125,6 +125,9 @@ test_manager=测试经理
|
|||
tester=测试成员
|
||||
read_only_user=只读用户
|
||||
module=模块
|
||||
num_needed_modify_testcase=修改用例时ID必填
|
||||
num_needless_create_testcase=创建用例时无需ID
|
||||
tag_tip_pattern=标签之间以分号或者逗号隔开
|
||||
preconditions_optional=前置条件选填
|
||||
step_tip_separate=每个步骤以换行分隔
|
||||
step_tip_order=步骤前可标序号
|
||||
|
|
|
@ -125,6 +125,9 @@ test_manager=測試經理
|
|||
tester=測試成員
|
||||
read_only_user=只讀用戶
|
||||
module=模塊
|
||||
num_needed_modify_testcase=修改用例時ID必填
|
||||
num_needless_create_testcase=創建用例時無需ID
|
||||
tag_tip_pattern=標籤之間以分號或者逗號隔開
|
||||
preconditions_optional=前置條件選填
|
||||
step_tip_separate=每個步驟以換行分隔
|
||||
step_tip_order=步驟前可標序號
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 07951ba17aef6f29e50cfd68e40de3266f9a60cd
|
||||
Subproject commit 2115bd28a90854d2b6276a90878934715498c584
|
Loading…
Reference in New Issue