fix(功能用例): 功能用例导入未校验状态值

--bug=1010007 --user=李敏 【测试跟踪】github#9919,功能用例导入的时候状态填的不对,没做校验 https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001010007
This commit is contained in:
limin-fit2 2022-01-26 16:51:05 +08:00 committed by john1298308460
parent fd4cb4158b
commit 3dd81a000d
5 changed files with 28 additions and 6 deletions

View File

@ -210,6 +210,9 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
String value = null;
if (StringUtils.equals(customName, "status")) {
value = data.getStatus();
if (!checkCaseStatus(value)){
stringBuilder.append(Translator.get("case_status_not_exist") + "; ");
}
}else if (StringUtils.equals(customName, "priority")) {
value = data.getPriority();
}else if (StringUtils.equals(customName, "maintainer")) {
@ -359,6 +362,21 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
}
/**
* 检验导入功能用例的状态
* @param status
* @return
*/
private boolean checkCaseStatus(String status){
if (StringUtils.equalsAnyIgnoreCase(status, "Underway", "进行中", "進行中")) {
return true;
} else if (StringUtils.equalsAnyIgnoreCase(status, "Prepare", "未开始", "未開始")) {
return true;
} else if (StringUtils.equalsAnyIgnoreCase(status, "Completed", "已完成", "已完成")) {
return true;
}
return false;
}
private TestCaseWithBLOBs convert2TestCase(TestCaseExcelData data) {
TestCaseWithBLOBs testCase = new TestCaseWithBLOBs();
@ -388,11 +406,11 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
JSONArray customArr = new JSONArray();
String caseStatusValue = "";
if (StringUtils.equalsAny(data.getStatus(), "Underway","underway", "进行中", "進行中")) {
if (StringUtils.equalsAnyIgnoreCase(data.getStatus(), "Underway", "进行中", "進行中")) {
caseStatusValue = "Underway";
} else if (StringUtils.equalsAny(data.getStatus(), "Prepare","prepare", "未开始", "未開始")) {
} else if (StringUtils.equalsAnyIgnoreCase(data.getStatus(), "Prepare", "未开始", "未開始")) {
caseStatusValue = "Prepare";
} else if (StringUtils.equalsAny(data.getStatus(), "Completed", "completed","已完成", "已完成")) {
} else if (StringUtils.equalsAnyIgnoreCase(data.getStatus(), "Completed","已完成", "已完成")) {
caseStatusValue = "Completed";
}
data.setStatus(caseStatusValue);
@ -441,11 +459,11 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
JSONArray customArr = new JSONArray();
String caseStatusValue = "";
if (StringUtils.equalsAny(data.getStatus(), "Underway","underway" ,"进行中", "進行中")) {
if (StringUtils.equalsAnyIgnoreCase(data.getStatus(), "Underway","进行中", "進行中")) {
caseStatusValue = "Underway";
} else if (StringUtils.equalsAny(data.getStatus(), "Prepare","prepare" ,"未开始", "未開始")) {
} else if (StringUtils.equalsAnyIgnoreCase(data.getStatus(), "Prepare","未开始", "未開始")) {
caseStatusValue = "Prepare";
} else if (StringUtils.equalsAny(data.getStatus(), "Completed", "completed","已完成", "已完成")) {
} else if (StringUtils.equalsAnyIgnoreCase(data.getStatus(), "Completed", "已完成", "已完成")) {
caseStatusValue = "Completed";
}
data.setStatus(caseStatusValue);

View File

@ -74,3 +74,4 @@ invalid_parameter=
workspace_template_settings_issue=
zentao_test_type_error=
issue_jira_info_error=
case_status_not_exist=

View File

@ -162,6 +162,7 @@ custom_num_is_not_exist=Use case custom ID not exists
id_required=ID required
id_repeat_in_table=ID is repeat in table
step_model_tip=Step description fill in STEP, text description please fill in TEXT (not required)
case_status_not_exist=The use case status must be Prepare, Underway way and Completed
#ldap
ldap_url_is_null=LDAP address is empty
ldap_dn_is_null=LDAP binding DN is empty

View File

@ -162,6 +162,7 @@ custom_num_is_not_exist=用例自定义ID不存在
id_required=ID必填
id_repeat_in_table=表格内ID重复
step_model_tip=步骤描述填写 STEP,文本描述请填写 TEXT (非必填)
case_status_not_exist=用例状态必须为未开始(Prepare)、进行中(Underway)、已完成(Completed)
#ldap
ldap_url_is_null=LDAP地址为空
ldap_dn_is_null=LDAP绑定DN为空

View File

@ -162,6 +162,7 @@ custom_num_is_not_exist=用例自定義ID不存在
id_required=ID必填
id_repeat_in_table=表格內ID重復
step_model_tip=步驟描述填寫 STEP,文本描述請填寫 TEXT (非必填)
case_status_not_exist=用例狀態必須為未開始Prepare、進行中Underway、已完成Completed
#ldap
ldap_url_is_null=LDAP地址為空
ldap_dn_is_null=LDAP綁定DN為空