fix(测试跟踪): 功能用例导出字段过长,其他字段也显示为空
--bug=1026585 --user=陈建星 【测试跟踪】github#24655,功能字段自定义字段过长时,导出功能用例为Excel,导出成功,但自定义字段均为空 https://www.tapd.cn/55049933/s/1379430
This commit is contained in:
parent
a8b46ce905
commit
8bd8200ffe
|
@ -1835,7 +1835,7 @@ public class TestCaseService {
|
|||
buildExportCustomField(customSelectValueMap, customNameMap, t, data, textFields);
|
||||
buildExportOtherField(data, t, otherHeaders);
|
||||
|
||||
this.validateExportTextField(t);
|
||||
this.validateExportTextField(data);
|
||||
if (CollectionUtils.isNotEmpty(stepDescList)) {
|
||||
// 如果有多条步骤则添加多条数据,之后合并单元格
|
||||
buildExportMergeData(rowMergeInfo, list, stepDescList, stepResultList, data);
|
||||
|
@ -1846,19 +1846,20 @@ public class TestCaseService {
|
|||
return list;
|
||||
}
|
||||
|
||||
private void validateExportTextField(TestCaseDTO data) {
|
||||
List<String> textValues= Arrays.asList(data.getPrerequisite(), data.getStepDescription(), data.getExpectedResult(), data.getRemark());
|
||||
for (String textValue : textValues) {
|
||||
validateExportText(data.getName(), textValue);
|
||||
}
|
||||
private void validateExportTextField(TestCaseExcelData data) {
|
||||
data.setPrerequisite(validateExportText(data.getPrerequisite()));
|
||||
data.setRemark(validateExportText(data.getRemark()));
|
||||
data.setStepDesc(validateExportText(data.getStepDesc()));
|
||||
data.setStepResult(validateExportText(data.getStepResult()));
|
||||
}
|
||||
|
||||
private void validateExportText(String name, String textValue) {
|
||||
private String validateExportText(String textValue) {
|
||||
// poi 导出的单个单元格最大字符数量为 32767 ,这里添加校验提示
|
||||
int maxLength = 32767;
|
||||
if (StringUtils.isNotBlank(textValue) && textValue.length() > maxLength) {
|
||||
MSException.throwException(String.format(Translator.get("case_export_text_validate_tip"), name, maxLength));
|
||||
return String.format(Translator.get("case_export_text_validate_tip"), maxLength);
|
||||
}
|
||||
return textValue;
|
||||
}
|
||||
|
||||
private void buildExportOtherField(TestCaseExcelData data, TestCaseDTO t, List<TestCaseExportRequest.TestCaseExportHeader> otherHeaders) {
|
||||
|
@ -1926,8 +1927,7 @@ public class TestCaseService {
|
|||
//进行key value对换
|
||||
String id = field.getFieldId();
|
||||
if (textFields.contains(id)) {
|
||||
map.put(customNameMap.get(id), field.getTextValue());
|
||||
this.validateExportText(data.getName(), field.getTextValue());
|
||||
map.put(customNameMap.get(id), this.validateExportText(field.getTextValue()));
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isNotBlank(field.getValue())) {
|
||||
|
|
|
@ -234,6 +234,6 @@ api_status_fake_error=FakeError
|
|||
serial=Serial
|
||||
parallel=Parallel
|
||||
rerun_warning=The report is being rerun, check it later
|
||||
case_export_text_validate_tip=Use case %s contains extremely long text, currently supported up to %s!
|
||||
case_export_text_validate_tip=Contains extremely long text, currently supported up to %s!
|
||||
case_import_table_header_missing=Header information is missing!
|
||||
relate_resource=relate
|
||||
|
|
|
@ -205,6 +205,6 @@ api_status_fake_error=误报
|
|||
serial=串行
|
||||
parallel=并行
|
||||
rerun_warning=报告正在重跑中,稍后查看
|
||||
case_export_text_validate_tip=用例 %s 包含超长文本,目前支持最大长度为 %s !
|
||||
case_export_text_validate_tip=包含超长文本,目前支持最大长度为 %s !
|
||||
case_import_table_header_not_exist=缺少表头信息!
|
||||
relate_resource=关联
|
||||
|
|
|
@ -205,6 +205,6 @@ api_status_fake_error=誤報
|
|||
serial=串行
|
||||
parallel=並行
|
||||
rerun_warning=報告正在重跑中,稻後查看
|
||||
case_export_text_validate_tip=用例 %s 包含超長文本,目前支持最大長度為 %s !
|
||||
case_export_text_validate_tip=包含超長文本,目前支持最大長度為 %s !
|
||||
case_import_table_header_not_exist=缺少表頭信息!
|
||||
relate_resource=關聯
|
||||
|
|
Loading…
Reference in New Issue