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