From bf81de8926afa0fa0e9692277b8d2173208790e4 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 19 Feb 2021 16:45:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dhttps://github.com/metersphere/metersphere/is?= =?UTF-8?q?sues/659=20=E5=AF=B9=E5=BA=94=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/xmind/XmindCaseParser.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java index a2e5645e8c..8829d61ba0 100644 --- a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java +++ b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java @@ -276,22 +276,19 @@ public class XmindCaseParser { testCase.setType("functional"); String tc = title.replace(":", ":"); - String[] tcArr = tc.split(":"); - if (tcArr.length < 1) { + String[] tcArrs = tc.split(":"); + if (tcArrs.length < 1) { process.add(Translator.get("test_case_name") + Translator.get("incorrect_format"), title); return; } // 用例名称 - StringBuffer name = new StringBuffer(); - for (int i = 1; i < tcArr.length; i++) { - name.append(tcArr[i]); - } - testCase.setName(name.toString()); + String name = title.replace(tcArrs[0] + ":", "").replace(tcArrs[0] + ":", ""); + testCase.setName(name); testCase.setNodePath(nodePath); // 用例等级和用例性质处理 - if (tcArr[0].indexOf("-") != -1) { - for (String item : tcArr[0].split("-")) { + if (tcArrs[0].indexOf("-") != -1) { + for (String item : tcArrs[0].split("-")) { if (isAvailable(item, TC_REGEX)) { continue; } else if (item.toUpperCase().startsWith("P")) {