From 403f6ecb7600cf3c8f9b4cc1581974c147f9984d Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Mon, 13 Feb 2023 16:56:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A5=E5=8F=A3=E5=9C=BA=E6=99=AF=E4=B8=AD?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E7=9A=84=E5=9C=BA=E6=99=AF=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BA=86=E4=BD=86=E6=98=AF=E6=8A=A5=E5=91=8A=E5=8D=B4=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=8F=98=E5=8C=96=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1022856 --user=宋天阳 【接口测试】github#21635,A场景中引用方式导入B场景,如B场景内容发送修改,批量执行或测试计划执行A场景时,测试报告中的B场景还是老内容 https://www.tapd.cn/55049933/s/1334688 --- .../scenario/ApiScenarioReportStructureService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 333ed578a0..43958b16ad 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 @@ -16,6 +16,8 @@ import io.metersphere.constants.RunModeConstants; import io.metersphere.dto.RequestResult; import io.metersphere.dto.RunModeConfigDTO; import io.metersphere.service.BaseTestResourcePoolService; +import io.metersphere.service.MsHashTreeService; +import jakarta.annotation.Resource; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.BooleanUtils; @@ -26,7 +28,6 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import jakarta.annotation.Resource; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.atomic.AtomicLong; @@ -159,6 +160,10 @@ public class ApiScenarioReportStructureService { public static StepTreeDTO dataFormatting(String id, String name, String scenarioDefinition, String reportType) { JSONObject element = JSONUtil.parseObject(scenarioDefinition); if (element != null && element.getBoolean(ENABLE)) { + //保证场景的步骤是最新的(比如场景中包含引用场景) + MsHashTreeService hashTreeService = CommonBeanFactory.getBean(MsHashTreeService.class); + assert hashTreeService != null; + hashTreeService.dataFormatting(element); String resourceId = combinationResourceId(element, reportType, id); StepTreeDTO dto = new StepTreeDTO(name, resourceId, element.optString(TYPE), resourceId, 1); dto.setAllIndex(null);