diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java index 43958b16ad..345c9a0101 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioReportStructureService.java @@ -567,8 +567,6 @@ public class ApiScenarioReportStructureService { if (CollectionUtils.isNotEmpty(reportStructureWithBLOBs) && CollectionUtils.isNotEmpty(reportResults)) { ApiScenarioReportStructureWithBLOBs scenarioReportStructure = reportStructureWithBLOBs.get(0); List stepList = JSON.parseArray(new String(scenarioReportStructure.getResourceTree(), StandardCharsets.UTF_8), StepTreeDTO.class); - //判断是否含有全局前后置脚本,如果有的话需要将脚本内容添加到stepDTO中 - reportResults = this.filterProcessResult(reportResults); reportDTO.setTotal(reportResults.size()); reportDTO.setError(reportResults.stream().filter(e -> StringUtils.equals(e.getStatus(), ApiReportStatus.ERROR.name())).collect(Collectors.toList()).size()); diff --git a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/jmeter/JMeterBase.java b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/jmeter/JMeterBase.java index 790e0ceaf0..3013a34a78 100644 --- a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/jmeter/JMeterBase.java +++ b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/jmeter/JMeterBase.java @@ -224,6 +224,7 @@ public class JMeterBase { String evnStr = result.getResponseDataAsString(); environmentList.add(evnStr); } else { + //检查是否有关系到最终执行结果的全局前后置脚本。 boolean resultNotFilterOut = ListenerUtil.checkResultIsNotFilterOut(requestResult); if (resultNotFilterOut) { if (StringUtils.isNotEmpty(requestResult.getName()) && requestResult.getName().startsWith("Transaction=")) { @@ -231,6 +232,11 @@ public class JMeterBase { } else { requestResults.add(requestResult); } + } else { + //全局前后置脚本的执行结果不影响场景执行结果,默认它们都是执行成功的 + requestResult.setError(0); + requestResult.setSuccess(true); + requestResults.add(requestResult); } } });