fix(接口测试): 前置等待时间禁用不生效

This commit is contained in:
AgAngle 2024-04-12 15:10:20 +08:00 committed by Craftsman
parent 10d92940aa
commit 7861bca060
3 changed files with 17 additions and 5 deletions

View File

@ -134,19 +134,24 @@ public class MsCommonElementConverter extends AbstractJmeterElementConverter<MsC
isPre ? MsProcessorConverterFactory::getPreConverter : MsProcessorConverterFactory::getPostConverter; isPre ? MsProcessorConverterFactory::getPreConverter : MsProcessorConverterFactory::getPostConverter;
// 处理环境中步骤前处理器 // 处理环境中步骤前处理器
beforeStepProcessors.forEach(processor -> { beforeStepProcessors.stream()
.filter(MsProcessor::getEnable)
.forEach(processor -> {
processor.setProjectId(msCommonElement.getProjectId()); processor.setProjectId(msCommonElement.getProjectId());
getConverterFunc.apply(processor.getClass()).parse(tree, processor, config); getConverterFunc.apply(processor.getClass()).parse(tree, processor, config);
}); });
processorConfig.getProcessors() processorConfig.getProcessors().stream()
.filter(MsProcessor::getEnable)
.forEach(processor -> { .forEach(processor -> {
processor.setProjectId(msCommonElement.getProjectId()); processor.setProjectId(msCommonElement.getProjectId());
getConverterFunc.apply(processor.getClass()).parse(tree, processor, config); getConverterFunc.apply(processor.getClass()).parse(tree, processor, config);
}); });
// 处理环境中步骤后处理器 // 处理环境中步骤后处理器
afterStepProcessors.forEach(processor -> { afterStepProcessors.stream()
.filter(MsProcessor::getEnable)
.forEach(processor -> {
processor.setProjectId(msCommonElement.getProjectId()); processor.setProjectId(msCommonElement.getProjectId());
getConverterFunc.apply(processor.getClass()).parse(tree, processor, config); getConverterFunc.apply(processor.getClass()).parse(tree, processor, config);
}); });

View File

@ -242,7 +242,9 @@ public class MsScenarioConverter extends AbstractJmeterElementConverter<MsScenar
isPre ? MsProcessorConverterFactory::getPreConverter : MsProcessorConverterFactory::getPostConverter; isPre ? MsProcessorConverterFactory::getPreConverter : MsProcessorConverterFactory::getPostConverter;
// 添加前后置 // 添加前后置
envScenarioProcessors.forEach(processor -> { envScenarioProcessors.stream()
.filter(MsProcessor::getEnable)
.forEach(processor -> {
processor.setProjectId(msScenario.getProjectId()); processor.setProjectId(msScenario.getProjectId());
getConverterFunc.apply(processor.getClass()).parse(tree, processor, config); getConverterFunc.apply(processor.getClass()).parse(tree, processor, config);
}); });
@ -289,7 +291,9 @@ public class MsScenarioConverter extends AbstractJmeterElementConverter<MsScenar
isPre ? MsProcessorConverterFactory::getPreConverter : MsProcessorConverterFactory::getPostConverter; isPre ? MsProcessorConverterFactory::getPreConverter : MsProcessorConverterFactory::getPostConverter;
// 添加场景前置处理器 // 添加场景前置处理器
scenarioPreProcessors.forEach(processor -> { scenarioPreProcessors.stream()
.filter(MsProcessor::getEnable)
.forEach(processor -> {
processor.setProjectId(msScenario.getProjectId()); processor.setProjectId(msScenario.getProjectId());
getConverterFunc.apply(processor.getClass()).parse(tree, processor, config); getConverterFunc.apply(processor.getClass()).parse(tree, processor, config);
}); });

View File

@ -18,6 +18,9 @@ import static io.metersphere.api.parser.jmeter.constants.JmeterAlias.CONSTANT_TI
public class TimeWaitingProcessorConverter extends MsProcessorConverter<TimeWaitingProcessor> { public class TimeWaitingProcessorConverter extends MsProcessorConverter<TimeWaitingProcessor> {
@Override @Override
public void parse(HashTree hashTree, TimeWaitingProcessor processor, ParameterConfig config) { public void parse(HashTree hashTree, TimeWaitingProcessor processor, ParameterConfig config) {
if (!needParse(processor, config)) {
return;
}
hashTree.add(getConstantTimer(processor)); hashTree.add(getConstantTimer(processor));
} }