fix(接口测试): 修复资源池执行不更新通过率的缺陷
This commit is contained in:
parent
5dc609282b
commit
d559467f32
|
@ -2,6 +2,7 @@ package io.metersphere.api.jmeter.utils;
|
|||
|
||||
import io.metersphere.commons.constants.CommonConstants;
|
||||
import io.metersphere.commons.enums.ApiReportStatus;
|
||||
import io.metersphere.commons.utils.JSONUtil;
|
||||
import io.metersphere.commons.vo.ResultVO;
|
||||
import io.metersphere.dto.RequestResult;
|
||||
import io.metersphere.dto.ResultDTO;
|
||||
|
@ -51,7 +52,8 @@ public class ReportStatusUtil {
|
|||
}
|
||||
if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.REPORT_STATUS)) {
|
||||
// 资源池执行整体传输失败,单条传输内容,获取资源池执行统计的状态
|
||||
resultVO.setStatus(String.valueOf(dto.getArbitraryData().get(CommonConstants.REPORT_STATUS)));
|
||||
ResultVO o = (ResultVO) dto.getArbitraryData().get(CommonConstants.REPORT_STATUS);
|
||||
resultVO.setStatus(o.getStatus());
|
||||
}
|
||||
// 过滤掉重试结果后进行统计
|
||||
List<RequestResult> requestResults = filterRetryResults(dto.getRequestResults());
|
||||
|
@ -84,12 +86,12 @@ public class ReportStatusUtil {
|
|||
ResultVO result = new ResultVO();
|
||||
if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.LOCAL_STATUS_KEY)) {
|
||||
// 本地执行状态
|
||||
result = (ResultVO) dto.getArbitraryData().get(CommonConstants.LOCAL_STATUS_KEY);
|
||||
result = JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.LOCAL_STATUS_KEY), ResultVO.class);
|
||||
return result;
|
||||
}
|
||||
if (MapUtils.isNotEmpty(dto.getArbitraryData()) && dto.getArbitraryData().containsKey(CommonConstants.REPORT_STATUS)) {
|
||||
// 资源池执行整体传输失败,单条传输内容,获取资源池执行统计的状态
|
||||
result = (ResultVO) dto.getArbitraryData().get(CommonConstants.REPORT_STATUS);
|
||||
result = JSONUtil.convertValue(dto.getArbitraryData().get(CommonConstants.REPORT_STATUS), ResultVO.class);
|
||||
return result;
|
||||
}
|
||||
return getStatus(dto, result);
|
||||
|
|
|
@ -41,6 +41,14 @@ public class JSONUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static <T> T convertValue(Object content, Class<T> valueType) {
|
||||
try {
|
||||
return objectMapper.convertValue(content, valueType);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static String toJSONString(Object value) {
|
||||
try {
|
||||
return objectMapper.writeValueAsString(value);
|
||||
|
|
|
@ -426,7 +426,6 @@ public class ApiScenarioReportService {
|
|||
if (scenario != null) {
|
||||
scenario.setLastResult(resultVO.getStatus());
|
||||
scenario.setPassRate(resultVO.computerPassRate());
|
||||
scenario.setPassRate(resultVO.computerPassRate());
|
||||
scenario.setReportId(dto.getReportId());
|
||||
int executeTimes = 0;
|
||||
if (scenario.getExecuteTimes() != null) {
|
||||
|
|
Loading…
Reference in New Issue