Revert "fix(接口测试): 修复场景失败重试多次后报告状态统计错误问题"
This reverts commit 1a7b958bba
.
This commit is contained in:
parent
5a8cb928aa
commit
73bc91c6d1
|
@ -32,7 +32,6 @@ import io.metersphere.service.SystemParameterService;
|
||||||
import io.metersphere.service.UserService;
|
import io.metersphere.service.UserService;
|
||||||
import io.metersphere.track.dto.PlanReportCaseDTO;
|
import io.metersphere.track.dto.PlanReportCaseDTO;
|
||||||
import io.metersphere.utils.LoggerUtil;
|
import io.metersphere.utils.LoggerUtil;
|
||||||
import io.metersphere.utils.RetryResultUtil;
|
|
||||||
import io.metersphere.xmind.utils.FileUtil;
|
import io.metersphere.xmind.utils.FileUtil;
|
||||||
import org.apache.commons.beanutils.BeanMap;
|
import org.apache.commons.beanutils.BeanMap;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
@ -874,36 +873,12 @@ public class ApiScenarioReportService {
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RequestResult> filterRetryResults(List<RequestResult> results) {
|
|
||||||
List<RequestResult> list = new LinkedList<>();
|
|
||||||
if (CollectionUtils.isNotEmpty(results)) {
|
|
||||||
Map<String, List<RequestResult>> resultMap = results.stream().collect(Collectors.groupingBy(RequestResult::getResourceId));
|
|
||||||
resultMap.forEach((k, v) -> {
|
|
||||||
if (CollectionUtils.isNotEmpty(v)) {
|
|
||||||
// 校验是否含重试结果
|
|
||||||
List<RequestResult> isRetryResults = v
|
|
||||||
.stream()
|
|
||||||
.filter(c -> StringUtils.isNotEmpty(c.getName()) && c.getName().startsWith(RetryResultUtil.RETRY_CN))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
if (CollectionUtils.isNotEmpty(isRetryResults)) {
|
|
||||||
list.add(isRetryResults.get(isRetryResults.size() - 1));
|
|
||||||
} else {
|
|
||||||
// 成功的结果
|
|
||||||
list.addAll(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getStatus(ResultDTO dto) {
|
private String getStatus(ResultDTO dto) {
|
||||||
if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey("REPORT_STATUS")) {
|
if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey("REPORT_STATUS")) {
|
||||||
// 资源池执行整体传输失败,单条传输内容,获取资源池执行统计的状态
|
// 资源池执行整体传输失败,单条传输内容,获取资源池执行统计的状态
|
||||||
return String.valueOf(dto.getArbitraryData().get("REPORT_STATUS"));
|
return String.valueOf(dto.getArbitraryData().get("REPORT_STATUS"));
|
||||||
}
|
}
|
||||||
List<RequestResult> requestResults = filterRetryResults(dto.getRequestResults());
|
long errorSize = dto.getRequestResults().stream().filter(requestResult ->
|
||||||
long errorSize = requestResults.stream().filter(requestResult ->
|
|
||||||
StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Error.name())).count();
|
StringUtils.equalsIgnoreCase(requestResult.getStatus(), ScenarioStatus.Error.name())).count();
|
||||||
|
|
||||||
long errorReportResultSize = dto.getRequestResults().stream().filter(requestResult ->
|
long errorReportResultSize = dto.getRequestResults().stream().filter(requestResult ->
|
||||||
|
|
Loading…
Reference in New Issue