fix: 修复导出用例null

This commit is contained in:
wenyann 2020-09-08 15:23:16 +08:00
parent 34bf64ce73
commit 5eb9a5aadd
1 changed files with 7 additions and 1 deletions

View File

@ -386,7 +386,13 @@ public class TestCaseService {
data.setPrerequisite(t.getPrerequisite()); data.setPrerequisite(t.getPrerequisite());
if (t.getMethod().equals("manual")) { if (t.getMethod().equals("manual")) {
String steps = t.getSteps(); String steps = t.getSteps();
JSONArray jsonArray = JSON.parseArray(steps); String setp = "";
if (steps.contains("null")) {
setp = steps.replace("null", "");
} else {
setp = steps;
}
JSONArray jsonArray = JSON.parseArray(setp);
for (int j = 0; j < jsonArray.size(); j++) { for (int j = 0; j < jsonArray.size(); j++) {
int num = j + 1; int num = j + 1;
step.append(num + "." + jsonArray.getJSONObject(j).getString("desc") + "\n"); step.append(num + "." + jsonArray.getJSONObject(j).getString("desc") + "\n");