fix(测试跟踪): 测试用例导出报错

This commit is contained in:
chenjianxing 2020-10-28 09:58:48 +08:00
parent 4dfc963c40
commit 319b54ca7e

View File

@ -458,19 +458,11 @@ public class TestCaseService {
String steps = t.getSteps();
String setp = "";
if (steps.contains("null")) {
setp = steps.replace("null", "");
setp = steps.replace("null", "\"\"");
} else {
setp = steps;
}
JSONArray jsonArray = null;
try {
jsonArray = JSON.parseArray(setp);
} catch (Exception e) {
// 解决旧版本保存用例导出报错
setp.replace("\"desc\":,", "\"desc\":\"\",");
setp.replace("\"result\":}", "\"result\":\"\"}");
LogUtil.error(e.getMessage(), e);
}
JSONArray jsonArray = JSON.parseArray(setp);
for (int j = 0; j < jsonArray.size(); j++) {
int num = j + 1;
step.append(num + "." + jsonArray.getJSONObject(j).getString("desc") + "\n");