feat(测试用例): 修复功能用例xmind导入报错问题
--bug=1048527 --user=王旭 [功能用例]github#33991功能用例导出为xmind再导入会报错 “Index 1 out of bounds for length 1” https://www.tapd.cn/55049933/s/1607845
This commit is contained in:
parent
47f4b2c594
commit
c8f871dbc0
|
@ -308,7 +308,7 @@ public class XMindCaseParser {
|
||||||
private void formatTestCase(String title, String nodePath, List<Attached> attacheds) {
|
private void formatTestCase(String title, String nodePath, List<Attached> attacheds) {
|
||||||
FunctionalCaseExcelData testCase = new FunctionalCaseExcelData();
|
FunctionalCaseExcelData testCase = new FunctionalCaseExcelData();
|
||||||
String tc = title.replace(":", ":");
|
String tc = title.replace(":", ":");
|
||||||
String[] tcArrs = tc.split(":");
|
String[] tcArrs = tc.split(":", 2);
|
||||||
if (tcArrs.length <= 1) {
|
if (tcArrs.length <= 1) {
|
||||||
process.add(Translator.get("test_case_name") + Translator.get("incorrect_format"), title);
|
process.add(Translator.get("test_case_name") + Translator.get("incorrect_format"), title);
|
||||||
return;
|
return;
|
||||||
|
@ -415,8 +415,8 @@ public class XMindCaseParser {
|
||||||
functionalCaseStepDTO.setNum(i + 1);
|
functionalCaseStepDTO.setNum(i + 1);
|
||||||
if (isAvailable(attacheds.get(i).getTitle(), STEP)) {
|
if (isAvailable(attacheds.get(i).getTitle(), STEP)) {
|
||||||
String stepDesc = attacheds.get(i).getTitle().replace(":", ":");
|
String stepDesc = attacheds.get(i).getTitle().replace(":", ":");
|
||||||
String[] stepDescArrs = stepDesc.split(":");
|
String[] stepDescArrs = stepDesc.split(":", 2);
|
||||||
functionalCaseStepDTO.setDesc(StringUtils.isNotBlank(stepDescArrs[1]) ? stepDescArrs[1] : StringUtils.EMPTY);
|
functionalCaseStepDTO.setDesc(stepDescArrs.length < 2 ? StringUtils.EMPTY : stepDescArrs[1]);
|
||||||
} else {
|
} else {
|
||||||
functionalCaseStepDTO.setDesc(StringUtils.EMPTY);
|
functionalCaseStepDTO.setDesc(StringUtils.EMPTY);
|
||||||
}
|
}
|
||||||
|
@ -429,8 +429,8 @@ public class XMindCaseParser {
|
||||||
String title = attacheds.get(i).getChildren().getAttached().get(0).getTitle();
|
String title = attacheds.get(i).getChildren().getAttached().get(0).getTitle();
|
||||||
if (isAvailable(title, EXPECTED_RESULT)) {
|
if (isAvailable(title, EXPECTED_RESULT)) {
|
||||||
String stepDesc = title.replace(":", ":");
|
String stepDesc = title.replace(":", ":");
|
||||||
String[] stepDescArrs = stepDesc.split(":");
|
String[] stepDescArrs = stepDesc.split(":", 2);
|
||||||
functionalCaseStepDTO.setResult(StringUtils.isNotBlank(stepDescArrs[1]) ? stepDescArrs[1] : StringUtils.EMPTY);
|
functionalCaseStepDTO.setResult(stepDescArrs.length < 2 ? StringUtils.EMPTY : stepDescArrs[1]);
|
||||||
} else {
|
} else {
|
||||||
functionalCaseStepDTO.setResult(StringUtils.EMPTY);
|
functionalCaseStepDTO.setResult(StringUtils.EMPTY);
|
||||||
}
|
}
|
||||||
|
@ -452,6 +452,7 @@ public class XMindCaseParser {
|
||||||
}
|
}
|
||||||
return JSON.toJSONString(functionalCaseStepDTOS);
|
return JSON.toJSONString(functionalCaseStepDTOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取步骤数据
|
* 获取步骤数据
|
||||||
*/
|
*/
|
||||||
|
@ -460,7 +461,7 @@ public class XMindCaseParser {
|
||||||
String title = attacheds.get(0).getTitle();
|
String title = attacheds.get(0).getTitle();
|
||||||
if (isAvailable(title, EXPECTED_RESULT)) {
|
if (isAvailable(title, EXPECTED_RESULT)) {
|
||||||
String stepDesc = title.replace(":", ":");
|
String stepDesc = title.replace(":", ":");
|
||||||
String[] stepDescArrs = stepDesc.split(":");
|
String[] stepDescArrs = stepDesc.split(":", 2);
|
||||||
return StringUtils.isNotBlank(stepDescArrs[1]) ? stepDescArrs[1] : StringUtils.EMPTY;
|
return StringUtils.isNotBlank(stepDescArrs[1]) ? stepDescArrs[1] : StringUtils.EMPTY;
|
||||||
} else {
|
} else {
|
||||||
return StringUtils.EMPTY;
|
return StringUtils.EMPTY;
|
||||||
|
|
Loading…
Reference in New Issue