diff --git a/backend/src/main/java/io/metersphere/api/exec/utils/ResultParseUtil.java b/backend/src/main/java/io/metersphere/api/exec/utils/ResultParseUtil.java new file mode 100644 index 0000000000..37b7ea18d5 --- /dev/null +++ b/backend/src/main/java/io/metersphere/api/exec/utils/ResultParseUtil.java @@ -0,0 +1,17 @@ +package io.metersphere.api.exec.utils; + +import io.metersphere.dto.RequestResult; +import org.apache.commons.lang3.StringUtils; + +public class ResultParseUtil { + + private static final String PRE_PROCESS_SCRIPT = "PRE_PROCESSOR_ENV_"; + private static final String POST_PROCESS_SCRIPT = "POST_PROCESSOR_ENV_"; + + public static boolean isNotAutoGenerateSampler(RequestResult result) { + if (StringUtils.equals(result.getMethod(), "Request") && StringUtils.startsWithAny(result.getName(), PRE_PROCESS_SCRIPT, POST_PROCESS_SCRIPT)) { + return false; + } + return true; + } +} diff --git a/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java b/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java index 3f4affe895..c10b9f7f5a 100644 --- a/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java +++ b/backend/src/main/java/io/metersphere/api/jmeter/MsDebugListener.java @@ -22,6 +22,7 @@ import com.alibaba.fastjson.JSONObject; import io.metersphere.api.dto.ErrorReportLibraryParseDTO; import io.metersphere.api.dto.RunningParamKeys; import io.metersphere.api.exec.queue.PoolExecBlockingQueueUtil; +import io.metersphere.api.exec.utils.ResultParseUtil; import io.metersphere.api.service.MsResultService; import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.ErrorReportLibraryUtil; @@ -151,8 +152,7 @@ public class MsDebugListener extends AbstractListenerElement implements SampleLi this.setVars(result); if (isSampleWanted(result.isSuccessful()) && !StringUtils.equals(result.getSampleLabel(), RunningParamKeys.RUNNING_DEBUG_SAMPLER_NAME)) { RequestResult requestResult = JMeterBase.getRequestResult(result); - if (requestResult != null) { - + if (requestResult != null && ResultParseUtil.isNotAutoGenerateSampler(requestResult)) { MsgDto dto = new MsgDto(); dto.setExecEnd(false); dto.setReportId("send." + this.getName());