fix(UI自动化): grid挂掉情况下报告状态问题
This commit is contained in:
parent
bd18dfed79
commit
495da56a5b
|
@ -485,7 +485,7 @@ public class ApiScenarioReportService {
|
|||
}
|
||||
|
||||
public ApiScenarioReport updateUiScenario(List<ApiScenarioReportResultWithBLOBs> requestResults, ResultDTO dto) {
|
||||
long errorSize = requestResults.stream().filter(requestResult -> StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Error.name())).count();
|
||||
long errorSize = getUiErrorSize(dto);
|
||||
// 更新报告状态
|
||||
String status = getStatus(dto);
|
||||
|
||||
|
@ -963,12 +963,7 @@ public class ApiScenarioReportService {
|
|||
StringUtils.equalsIgnoreCase(requestResult.getStatus(), ExecuteResult.ERROR_REPORT_RESULT.toString())).count();
|
||||
//类型为ui时的统计
|
||||
if (StringUtils.isNotEmpty(dto.getRunMode()) && dto.getRunMode().startsWith("UI")) {
|
||||
try {
|
||||
errorSize = getUiErrorSize(dto);
|
||||
} catch (Exception e) {
|
||||
// UI 返回的结果在 headers 里面,格式不符合规范的直接认定结果为失败
|
||||
errorSize = 1;
|
||||
}
|
||||
}
|
||||
String status = dto.getRequestResults().isEmpty() ? ExecuteResult.UN_EXECUTE.toString() : ScenarioStatus.Success.name();
|
||||
if (errorSize > 0) {
|
||||
|
@ -992,6 +987,7 @@ public class ApiScenarioReportService {
|
|||
*/
|
||||
private long getUiErrorSize(ResultDTO dto) {
|
||||
int errorSize = 0;
|
||||
try {
|
||||
boolean success;
|
||||
String processType;
|
||||
String cmdName;
|
||||
|
@ -999,6 +995,9 @@ public class ApiScenarioReportService {
|
|||
if (CollectionUtils.isNotEmpty(dto.getRequestResults())) {
|
||||
r = dto.getRequestResults().get(dto.getRequestResults().size() - 1);
|
||||
}
|
||||
if (!StringUtils.contains(r.getName(), "WebDriverSampler")) {
|
||||
return 1;
|
||||
}
|
||||
if (StringUtils.isNotEmpty(r.getResponseResult().getHeaders())) {
|
||||
JSONArray responseArr = JSONArray.parseArray(r.getResponseResult().getHeaders());
|
||||
for (int i = 0; i < responseArr.size(); i++) {
|
||||
|
@ -1011,6 +1010,9 @@ public class ApiScenarioReportService {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
errorSize = 1;
|
||||
}
|
||||
return errorSize;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue