fix(测试用例): 导出增加标签

This commit is contained in:
WangXu10 2024-08-15 15:34:46 +08:00 committed by 刘瑞斌
parent 9cb1d6e2f8
commit 8cf4dc2f37
4 changed files with 17 additions and 1 deletions

View File

@ -24,6 +24,7 @@ public class FunctionalCaseExportColumns {
systemColumns.put("module", Translator.get("case.export.system.columns.module"));
systemColumns.put("text_description", Translator.get("case.export.system.columns.text_description"));
systemColumns.put("expected_result", Translator.get("case.export.system.columns.expected_result"));
systemColumns.put("tags", Translator.get("xmind_tags"));
// 其他字段
otherColumns.put("last_execute_result", Translator.get("case.export.system.other.columns.last_execute_result"));

View File

@ -630,6 +630,8 @@ public class FunctionalCaseFileService {
buildExportStep(data, functionalCaseBlob, functionalCase.getCaseEditType(), textDescriptionList, expectedResultList);
data.setPrerequisite(new String(functionalCaseBlob.getPrerequisite() == null ? new byte[0] : functionalCaseBlob.getPrerequisite(), StandardCharsets.UTF_8));
//标签
data.setTags(JSON.toJSONString(functionalCase.getTags()));
// 设置超链接
WriteCellData<String> hyperlink = new WriteCellData<>(functionalCase.getName());
data.setHyperLinkName(hyperlink);

View File

@ -236,7 +236,7 @@ public class FunctionalCaseXmindService {
dto.setNum(item.getNum().toString());
dto.setProjectId(item.getProjectId());
dto.setName(item.getName());
dto.setTags(item.getTags().toString());
dto.setTags(JSON.toJSONString(item.getTags()));
dto.setCaseEditType(item.getCaseEditType());
dto.setSteps(new String(functionalCaseBlob.getSteps() == null ? new byte[0] : functionalCaseBlob.getSteps(), StandardCharsets.UTF_8));
dto.setTextDescription(new String(functionalCaseBlob.getTextDescription() == null ? new byte[0] : functionalCaseBlob.getTextDescription(), StandardCharsets.UTF_8));

View File

@ -29,6 +29,7 @@ import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@ -440,6 +441,9 @@ public class XmindExportUtil {
case "module":
preTopic.setTitleText(columns.getSystemColumns().get(item).concat("").concat(moduleName));
break;
case "tags":
preTopic.setTitleText(columns.getSystemColumns().get(item).concat("").concat(parseTag(dto.getTags())));
break;
default:
break;
}
@ -545,5 +549,14 @@ public class XmindExportUtil {
topic.add(itemTopic);
}
private static String parseTag(String tags) {
List list = JSON.parseArray(tags);
AtomicReference<String> tag = new AtomicReference<>("");
list.forEach(item -> {
tag.set(tag.get() + item.toString().concat("|"));
});
return tag.get().substring(0, tag.get().length() - 1);
}
}