From 2441a882cc106047d12480e6ecb4e8898ffbb2d8 Mon Sep 17 00:00:00 2001 From: AgAngle <1323481023@qq.com> Date: Mon, 1 Apr 2024 17:41:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=AD=A5=E9=AA=A4=E7=BB=93=E6=9E=9C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=AD=A5=E9=AA=A4ID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/spi/AbstractJmeterElementConverter.java | 17 +++++++++++++++++ .../parser/jmeter/MsHTTPElementConverter.java | 16 ---------------- .../parser/jmeter/MsScriptElementConverter.java | 3 +++ 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/backend/framework/plugin/plugin-api-sdk/src/main/java/io/metersphere/plugin/api/spi/AbstractJmeterElementConverter.java b/backend/framework/plugin/plugin-api-sdk/src/main/java/io/metersphere/plugin/api/spi/AbstractJmeterElementConverter.java index c5a194b5b1..893458a032 100644 --- a/backend/framework/plugin/plugin-api-sdk/src/main/java/io/metersphere/plugin/api/spi/AbstractJmeterElementConverter.java +++ b/backend/framework/plugin/plugin-api-sdk/src/main/java/io/metersphere/plugin/api/spi/AbstractJmeterElementConverter.java @@ -1,8 +1,10 @@ package io.metersphere.plugin.api.spi; +import io.metersphere.plugin.api.constants.ElementProperty; import io.metersphere.plugin.api.dto.ParameterConfig; import lombok.Setter; +import org.apache.jmeter.testelement.TestElement; import org.apache.jorphan.collections.HashTree; import java.lang.reflect.ParameterizedType; @@ -49,4 +51,19 @@ public abstract class AbstractJmeterElementConverter im }); } } + + /** + * 设置步骤标识 + * 当前步骤唯一标识,结果和步骤匹配的关键 + * + * @param msHTTPElement + * @param config + * @param sampler + */ + public void setStepIdentification(AbstractMsTestElement msHTTPElement, ParameterConfig config, TestElement sampler) { + sampler.setProperty(ElementProperty.MS_RESOURCE_ID.name(), msHTTPElement.getResourceId()); + sampler.setProperty(ElementProperty.MS_STEP_ID.name(), msHTTPElement.getStepId()); + sampler.setProperty(ElementProperty.MS_REPORT_ID.name(), config.getReportId()); + sampler.setProperty(ElementProperty.PROJECT_ID.name(), msHTTPElement.getProjectId()); + } } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/parser/jmeter/MsHTTPElementConverter.java b/backend/services/api-test/src/main/java/io/metersphere/api/parser/jmeter/MsHTTPElementConverter.java index b4eb75e6c5..a3412e7aaf 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/parser/jmeter/MsHTTPElementConverter.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/parser/jmeter/MsHTTPElementConverter.java @@ -13,7 +13,6 @@ import io.metersphere.api.parser.jmeter.body.MsBodyConverterFactory; import io.metersphere.api.parser.jmeter.body.MsFormDataBodyConverter; import io.metersphere.api.parser.jmeter.body.MsWWWFormBodyConverter; import io.metersphere.jmeter.mock.Mock; -import io.metersphere.plugin.api.constants.ElementProperty; import io.metersphere.plugin.api.dto.ParameterConfig; import io.metersphere.plugin.api.spi.AbstractJmeterElementConverter; import io.metersphere.project.api.KeyValueEnableParam; @@ -201,21 +200,6 @@ public class MsHTTPElementConverter extends AbstractJmeterElementConverter