feat(测试跟踪): xmind 导入用例增加标签处理

This commit is contained in:
fit2-zhao 2021-03-08 17:00:32 +08:00
parent 3e985afc4b
commit bace68bd85
3 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package io.metersphere.xmind;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.ImmutableMap;
@ -73,6 +74,7 @@ public class XmindCaseParser {
private static final String TC_REGEX = "(?:tc:|tc|tc)";
private static final String PC_REGEX = "(?:pc:|pc|pc)";
private static final String RC_REGEX = "(?:rc:|rc|rc)";
private static final String TAG_REGEX = "(?:tag:|tag|tag)";
public void clear() {
compartDatas.clear();
@ -302,6 +304,7 @@ public class XmindCaseParser {
// 测试步骤处理
List<Attached> steps = new LinkedList<>();
StringBuilder rc = new StringBuilder();
List<String> tags = new LinkedList<>();
if (attacheds != null && !attacheds.isEmpty()) {
attacheds.forEach(item -> {
if (isAvailable(item.getTitle(), PC_REGEX)) {
@ -309,12 +312,15 @@ public class XmindCaseParser {
} else if (isAvailable(item.getTitle(), RC_REGEX)) {
rc.append(replace(item.getTitle(), RC_REGEX));
rc.append("\n");
} else if (isAvailable(item.getTitle(), TAG_REGEX)) {
tags.add(replace(item.getTitle(), TAG_REGEX));
} else {
steps.add(item);
}
});
}
testCase.setRemark(rc.toString());
testCase.setTags(JSON.toJSONString(tags));
testCase.setSteps(this.getSteps(steps));
// 校验合规性
if (validate(testCase)) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 29 KiB