fix: 测试用例导入标签
This commit is contained in:
parent
5dd39b60e5
commit
57bddf4bd0
|
@ -142,7 +142,7 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
public void saveData() {
|
||||
|
||||
//excel中用例都有错误时就返回,只要有用例可用于更新或者插入就不返回
|
||||
if (!errList.isEmpty() && list.size() == 0 && updateList.size() == 0) {
|
||||
if (!errList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -231,15 +231,23 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
*/
|
||||
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;
|
||||
try {
|
||||
if (StringUtils.isNotBlank(tags)) {
|
||||
JSONArray.parse(tags);
|
||||
return tags;
|
||||
}
|
||||
return "[]";
|
||||
} catch (Exception e) {
|
||||
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 "[]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue