fix(测试跟踪): 导入xmind 模块标题有效性校验

This commit is contained in:
fit2-zhao 2020-09-29 16:36:59 +08:00
parent 7bccd9f502
commit 61eaeb45e9
4 changed files with 13 additions and 3 deletions

View File

@ -95,6 +95,7 @@ public class XmindCaseParser {
item.setParent(parent);
this.newTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null);
} else {
validLength(item.getTitle());
String nodePath = parent.getPath() + "/" + item.getTitle();
item.setPath(nodePath);
item.setParent(parent);
@ -221,6 +222,13 @@ public class XmindCaseParser {
compartDatas.add(compartData);
}
private void validLength(String title) {
if (StringUtils.equals(title.trim(), ""))
process.append(Translator.get("module_not_null") + "; ");
if (title.length() > 30)
process.append(title + "" + Translator.get("test_track.length_less_than") + "30 ;");
}
// 验证合法性
private boolean validate(TestCaseWithBLOBs data) {
String nodePath = data.getNodePath();
@ -273,9 +281,9 @@ public class XmindCaseParser {
if (isAvailable(item.getTitle(), "(?:tc:|tc|tc)")) { // 用例
return replace(item.getTitle(), "(?:tc:|tc|tc)") + "" + Translator.get("test_case_create_module_fail");
} else {
validLength(item.getTitle());
item.setPath(item.getTitle());
if (item.getChildren() != null && !item.getChildren().getAttached().isEmpty()) {
item.setPath(item.getTitle());
recursion(processBuffer, item, 1, item.getChildren().getAttached());
}
}

View File

@ -157,3 +157,4 @@ import_xmind_not_found=Test case not found
license_valid_license_error=Authorization authentication failed
timing_task_result_notification=Timing task result notification
test_review_task_notice=Test review task notice
test_track.length_less_than=The title is too long, the length must be less than

View File

@ -157,5 +157,5 @@ license_valid_license_error=授权认证失败
import_xmind_not_found=未找到测试用例
timing_task_result_notification=定时任务结果通知
test_review_task_notice=测试评审任务通知
test_track.length_less_than=标题过长,字数必须小于

View File

@ -157,4 +157,5 @@ email_subject=MeterSphere定時任務結果通知
import_xmind_count_error=思維導圖導入用例數量不能超過 500 條
import_xmind_not_found=未找到测试用例
timing_task_result_notification=定時任務結果通知
test_review_task_notice=測試評審任務通知
test_review_task_notice=測試評審任務通知
test_track.length_less_than=標題過長,字數必須小於