refactor(UI自动化): 报告error代码可读性
This commit is contained in:
parent
e76a394d12
commit
98e40f8cb3
|
@ -914,21 +914,23 @@ public class ApiScenarioReportService {
|
||||||
*/
|
*/
|
||||||
private long getUiErrorSize(ResultDTO dto) {
|
private long getUiErrorSize(ResultDTO dto) {
|
||||||
int errorSize = 0;
|
int errorSize = 0;
|
||||||
|
boolean success = false;
|
||||||
|
String processType = null;
|
||||||
|
String cmdName = null;
|
||||||
for (RequestResult r : dto.getRequestResults()) {
|
for (RequestResult r : dto.getRequestResults()) {
|
||||||
if (StringUtils.isNotEmpty(r.getResponseResult().getHeaders())) {
|
if (StringUtils.isNotEmpty(r.getResponseResult().getHeaders())) {
|
||||||
JSONArray responseArr = JSONArray.parseArray(r.getResponseResult().getHeaders());
|
JSONArray responseArr = JSONArray.parseArray(r.getResponseResult().getHeaders());
|
||||||
for (int i = 0; i < responseArr.size(); i++) {
|
for (int i = 0; i < responseArr.size(); i++) {
|
||||||
JSONObject stepResult = responseArr.getJSONObject(i);
|
JSONObject stepResult = responseArr.getJSONObject(i);
|
||||||
if (stepResult.containsKey("success") && !stepResult.getBoolean("success")) {
|
success = Optional.ofNullable(stepResult.getBoolean("success")).orElse(Boolean.FALSE);
|
||||||
if ((stepResult.containsKey("processType") && StringUtils.equalsIgnoreCase("MAIN", stepResult.getString("processType")))
|
processType = Optional.ofNullable(stepResult.getString("processType")).orElse("");
|
||||||
|| (stepResult.containsKey("cmdName")
|
cmdName = Optional.ofNullable(stepResult.getString("cmdName")).orElse("");
|
||||||
&& ((stepResult.getString("cmdName").startsWith("verify")) || stepResult.getString("cmdName").startsWith("assert")))) {
|
if (!success && (StringUtils.equalsIgnoreCase("MAIN", processType) || cmdName.startsWith("verify") || cmdName.startsWith("assert"))) {
|
||||||
errorSize++;
|
errorSize++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return errorSize;
|
return errorSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue