fix(测试跟踪): 功能用例导入行号提示不准确

--bug=1015964 --user=陈建星 【测试跟踪】使用新模版导入用例,有报错时,报错提示需优化 https://www.tapd.cn/55049933/s/1230809
This commit is contained in:
AnAngle 2022-08-23 11:51:44 +08:00 committed by jianxing
parent 00810ec306
commit 501f6a6192
2 changed files with 10 additions and 2 deletions

View File

@ -95,6 +95,8 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
*/
private Boolean isMergeLastRow;
private Integer firstMergeRowIndex;
/**
* 存储合并单元格对应的数据key 为重写了 compareTo ExcelMergeInfo
*/
@ -146,6 +148,7 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
// 读取名称列如果该列是合并单元格则读取多行数据后合并步骤
if (this.isMergeRow) {
if (currentMergeData == null) {
this.firstMergeRowIndex = rowIndex;
// 如果是合并单元格的首行
testCaseExcelData = this.parseDataToModel(data);
testCaseExcelData.setMergeStepDesc(new ArrayList<>() {{
@ -176,6 +179,7 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
}
}
} else {
this.firstMergeRowIndex = null;
testCaseExcelData = this.parseDataToModel(data);
}
@ -193,10 +197,14 @@ public class TestCaseNoModelDataListener extends AnalysisEventListener<Map<Integ
}
if (!StringUtils.isEmpty(errMsg)) {
Integer errorRowIndex = rowIndex;
if (firstMergeRowIndex != null) {
errorRowIndex = firstMergeRowIndex;
}
ExcelErrData excelErrData = new ExcelErrData(testCaseExcelData, rowIndex,
Translator.get("number")
.concat(" ")
.concat(String.valueOf(rowIndex + 1)).concat(" ")
.concat(String.valueOf(errorRowIndex + 1)).concat(" ")
.concat(Translator.get("row"))
.concat(Translator.get("error"))
.concat("")

View File

@ -2,7 +2,7 @@ package io.metersphere.track.constants;
public enum TestCaseStatus {
Prepare("test_case_status_prepare"),
Underway("test_case_status_prepare"),
Underway("test_case_status_running"),
Completed("test_case_status_finished");
private String i18nKey;