refactor(接口测试): 内置属性统一处理

This commit is contained in:
fit2-zhao 2024-01-25 10:43:04 +08:00 committed by Craftsman
parent 144b26f213
commit 9117526096
3 changed files with 9 additions and 8 deletions

View File

@ -0,0 +1,5 @@
package io.metersphere.plugin.api.constants;
public enum ElementProperty {
MS_RESOURCE_ID, MS_STEP_ID, MS_FAKE_ERROR, MS_REPORT_ID
}

View File

@ -1,5 +0,0 @@
package io.metersphere.sdk.constants;
public enum ProcessDataStatus {
MS_RESOURCE_ID, MS_STEP_ID, MS_FAKE_ERROR
}

View File

@ -9,7 +9,7 @@ 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.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.sdk.constants.ProcessDataStatus; import io.metersphere.plugin.api.constants.ElementProperty;
import io.metersphere.sdk.util.LogUtils; import io.metersphere.sdk.util.LogUtils;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -44,8 +44,9 @@ public class MsHTTPElementConverter extends AbstractJmeterElementConverter<MsHTT
sampler.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(HTTP_TEST_SAMPLE_GUI)); sampler.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(HTTP_TEST_SAMPLE_GUI));
// TODO: 当前步骤唯一标识很重要结果和步骤匹配的关键 // TODO: 当前步骤唯一标识很重要结果和步骤匹配的关键
sampler.setProperty(ProcessDataStatus.MS_RESOURCE_ID.name(), msHTTPElement.getResourceId()); sampler.setProperty(ElementProperty.MS_RESOURCE_ID.name(), msHTTPElement.getResourceId());
sampler.setProperty(ProcessDataStatus.MS_STEP_ID.name(), msHTTPElement.getStepId()); sampler.setProperty(ElementProperty.MS_STEP_ID.name(), msHTTPElement.getStepId());
sampler.setProperty(ElementProperty.MS_REPORT_ID.name(), config.getReportId());
sampler.setMethod(msHTTPElement.getMethod()); sampler.setMethod(msHTTPElement.getMethod());
// todo 根据环境设置 // todo 根据环境设置