diff --git a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java index 193d96a6f6..5c42289b26 100644 --- a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java +++ b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java @@ -160,10 +160,10 @@ public class XmindCaseParser { //用例名称判断 - if(StringUtils.isEmpty(data.getName())){ + if (StringUtils.isEmpty(data.getName())) { validatePass = false; process.add("name" + Translator.get("cannot_be_null"), nodePath + ""); - }else { + } else { if (data.getName().length() > 200) { validatePass = false; process.add(Translator.get("test_case") + Translator.get("test_track.length_less_than") + "200", nodePath + data.getName()); @@ -171,7 +171,6 @@ public class XmindCaseParser { } - if (!StringUtils.isEmpty(nodePath)) { String[] nodes = nodePath.split("/"); if (nodes.length > TestCaseConstants.MAX_NODE_DEPTH + 1) { @@ -418,7 +417,13 @@ public class XmindCaseParser { testCase.setCustomNum(customId.toString()); } - testCase.setTags(JSON.toJSONString(tags)); + List tagsNew = new ArrayList(); + if (CollectionUtils.isNotEmpty(tags)) { + String tagsData = tags.get(0); + String[] array = tagsData.split("[, ,]"); + Arrays.asList(array).stream().forEach(x -> tagsNew.add(x)); + } + testCase.setTags(JSON.toJSONString(tagsNew)); testCase.setSteps(this.getSteps(steps)); // 校验合规性 if (validate(testCase)) {