fix(接口测试): 脚本步骤结果没有步骤ID
This commit is contained in:
parent
90da30e833
commit
2441a882cc
|
@ -1,8 +1,10 @@
|
||||||
package io.metersphere.plugin.api.spi;
|
package io.metersphere.plugin.api.spi;
|
||||||
|
|
||||||
|
|
||||||
|
import io.metersphere.plugin.api.constants.ElementProperty;
|
||||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.apache.jmeter.testelement.TestElement;
|
||||||
import org.apache.jorphan.collections.HashTree;
|
import org.apache.jorphan.collections.HashTree;
|
||||||
|
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
@ -49,4 +51,19 @@ public abstract class AbstractJmeterElementConverter<T extends MsTestElement> 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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.MsFormDataBodyConverter;
|
||||||
import io.metersphere.api.parser.jmeter.body.MsWWWFormBodyConverter;
|
import io.metersphere.api.parser.jmeter.body.MsWWWFormBodyConverter;
|
||||||
import io.metersphere.jmeter.mock.Mock;
|
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.dto.ParameterConfig;
|
||||||
import io.metersphere.plugin.api.spi.AbstractJmeterElementConverter;
|
import io.metersphere.plugin.api.spi.AbstractJmeterElementConverter;
|
||||||
import io.metersphere.project.api.KeyValueEnableParam;
|
import io.metersphere.project.api.KeyValueEnableParam;
|
||||||
|
@ -201,21 +200,6 @@ public class MsHTTPElementConverter extends AbstractJmeterElementConverter<MsHTT
|
||||||
return JmeterTestElementParserHelper.getArguments(msHTTPElement.getName(), envVariables);
|
return JmeterTestElementParserHelper.getArguments(msHTTPElement.getName(), envVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置步骤标识
|
|
||||||
* 当前步骤唯一标识,结果和步骤匹配的关键
|
|
||||||
*
|
|
||||||
* @param msHTTPElement
|
|
||||||
* @param config
|
|
||||||
* @param sampler
|
|
||||||
*/
|
|
||||||
private void setStepIdentification(MsHTTPElement msHTTPElement, ParameterConfig config, HTTPSamplerProxy 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());
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getPath(MsHTTPElement msHTTPElement, HttpConfig httpConfig) {
|
private String getPath(MsHTTPElement msHTTPElement, HttpConfig httpConfig) {
|
||||||
String url = msHTTPElement.getPath();
|
String url = msHTTPElement.getPath();
|
||||||
if (httpConfig != null) {
|
if (httpConfig != null) {
|
||||||
|
|
|
@ -29,6 +29,9 @@ public class MsScriptElementConverter extends AbstractJmeterElementConverter<MsS
|
||||||
scriptElement = new BeanShellSampler();
|
scriptElement = new BeanShellSampler();
|
||||||
}
|
}
|
||||||
ScriptProcessorConverter.parse(scriptElement, scriptProcessor, config);
|
ScriptProcessorConverter.parse(scriptElement, scriptProcessor, config);
|
||||||
|
|
||||||
|
setStepIdentification(msScriptElement, config, scriptElement);
|
||||||
|
|
||||||
hashTree.add(scriptElement);
|
hashTree.add(scriptElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue