fix(接口测试): 修复计划偶发无结果

--bug=1026438 --user=赵勇 【测试计划】【偶发】测试计划详情-接口列表,接口用例执行结果没更新 https://www.tapd.cn/55049933/s/1374302

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-05-23 11:53:58 +08:00 committed by fit2-zhao
parent 16d16b2479
commit b9844c40c1
3 changed files with 7 additions and 1 deletions

View File

@ -27,6 +27,7 @@ public class RemakeReportService {
BeanUtils.copyBean(dto, request);
dto.setQueueId(request.getQueueId());
dto.setTestId(request.getTestId());
dto.setErrorEnded(true);
LoggerUtil.info("进入异常结果处理:" + dto.getRunMode() + " 整体处理完成", dto.getReportId());
// 全局并发队列
PoolExecBlockingQueueUtil.offer(dto.getReportId());
@ -50,6 +51,7 @@ public class RemakeReportService {
BeanUtils.copyBean(dto, request);
dto.setQueueId(request.getQueueId());
dto.setTestId(request.getTestId());
dto.setErrorEnded(true);
String consoleMsg = FixedCapacityUtil.getJmeterLogger(dto.getReportId(), true);
dto.setConsole(consoleMsg + StringUtils.LF + errorMsg);
testResultService.testEnded(dto);

View File

@ -30,6 +30,7 @@ import io.metersphere.vo.ResultVO;
import jakarta.annotation.Resource;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -267,7 +268,7 @@ public class TestResultService {
sendTask(reportTask, dto.getTestId());
}
}
} else if (apiRunModes.contains(dto.getRunMode())) {
} else if (apiRunModes.contains(dto.getRunMode()) && BooleanUtils.isTrue(dto.getErrorEnded())) {
// 只处理RUNNING中的执行报告
updateRunningResult(dto);
}

View File

@ -21,6 +21,9 @@ public class ResultDTO {
private Boolean hasEnded;
// 失败重试
private boolean retryEnable;
// 异常终止
private Boolean errorEnded;
/**
* 增加一个全局扩展的通传参数
*/