refactor(测试跟踪): 统一变量

This commit is contained in:
fit2-zhao 2020-10-10 11:32:05 +08:00
parent 7833150db9
commit 956358e3b0
1 changed files with 11 additions and 11 deletions

View File

@ -33,13 +33,10 @@ public class XmindCaseParser {
private StringBuffer process; // 过程校验记录
// 已存在用例名称
private Set<String> testCaseNames;
// 转换后的案例信息
private List<TestCaseWithBLOBs> testCases;
// 案例详情重写了hashCode方法去重用
private List<TestCaseExcelData> compartDatas;
// 记录没有用例的目录
private List<String> nodePaths;
@ -54,7 +51,10 @@ public class XmindCaseParser {
nodePaths = new ArrayList<>();
}
// 这里清理是为了 加快jvm 回收
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)";
public void clear() {
compartDatas.clear();
testCases.clear();
@ -92,7 +92,7 @@ public class XmindCaseParser {
// 递归处理案例数据
private void recursion(Attached parent, int level, List<Attached> attacheds) {
for (Attached item : attacheds) {
if (isAvailable(item.getTitle(), "(?:tc|tc:|tc)")) { // 用例
if (isAvailable(item.getTitle(), TC_REGEX)) { // 用例
item.setParent(parent);
this.newTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null);
} else {
@ -188,10 +188,10 @@ public class XmindCaseParser {
List<Attached> steps = new LinkedList<>();
if (attacheds != null && !attacheds.isEmpty()) {
attacheds.forEach(item -> {
if (isAvailable(item.getTitle(), "(?:pc:|pc)")) {
testCase.setPrerequisite(replace(item.getTitle(), "(?:pc:|pc)"));
} else if (isAvailable(item.getTitle(), "(?:rc:|rc)")) {
testCase.setRemark(replace(item.getTitle(), "(?:rc:|rc)"));
if (isAvailable(item.getTitle(), PC_REGEX)) {
testCase.setPrerequisite(replace(item.getTitle(), PC_REGEX));
} else if (isAvailable(item.getTitle(), RC_REGEX)) {
testCase.setRemark(replace(item.getTitle(), RC_REGEX));
} else {
steps.add(item);
}
@ -274,8 +274,8 @@ public class XmindCaseParser {
if (root != null && root.getRootTopic() != null && root.getRootTopic().getChildren() != null) {
// 判断是模块还是用例
for (Attached item : root.getRootTopic().getChildren().getAttached()) {
if (isAvailable(item.getTitle(), "(?:tc:|tc|tc)")) { // 用例
return replace(item.getTitle(), "(?:tc:|tc|tc)") + "" + Translator.get("test_case_create_module_fail");
if (isAvailable(item.getTitle(), TC_REGEX)) { // 用例
return replace(item.getTitle(), TC_REGEX) + "" + Translator.get("test_case_create_module_fail");
} else {
String nodePath = item.getTitle();
item.setPath(nodePath);