fix(接口测试): 修复使用默认生成的Mock环境进行测试时会报错的缺陷

修复使用默认生成的Mock环境进行测试时会报错的缺陷
This commit is contained in:
song-tianyang 2022-01-27 16:58:58 +08:00 committed by xiaomeinvG
parent 28027266ab
commit f3dbe66b63
1 changed files with 4 additions and 4 deletions

View File

@ -74,17 +74,17 @@ public class JMeterScriptUtil {
boolean globalPreScriptIsFilter = JMeterScriptUtil.isScriptFilter(preFilterProtocal, protocal); boolean globalPreScriptIsFilter = JMeterScriptUtil.isScriptFilter(preFilterProtocal, protocal);
boolean globalPostScriptIsFilter = JMeterScriptUtil.isScriptFilter(postFilterProtocal, protocal); boolean globalPostScriptIsFilter = JMeterScriptUtil.isScriptFilter(postFilterProtocal, protocal);
if (isAfterPrivateScript) { if (isAfterPrivateScript) {
if (isPreScriptExecAfterPrivateScript && !globalPreScriptIsFilter && StringUtils.isNotEmpty(preProcessor.getScript())) { if (isPreScriptExecAfterPrivateScript && !globalPreScriptIsFilter && preProcessor != null && StringUtils.isNotEmpty(preProcessor.getScript())) {
addItemHashTree(preProcessor, samplerHashTree, config, environmentId); addItemHashTree(preProcessor, samplerHashTree, config, environmentId);
} }
if (isPostScriptExecAfterPrivateScript && !globalPostScriptIsFilter && StringUtils.isNotEmpty(postProcessor.getScript())) { if (isPostScriptExecAfterPrivateScript && !globalPostScriptIsFilter && postProcessor != null && StringUtils.isNotEmpty(postProcessor.getScript())) {
addItemHashTree(postProcessor, samplerHashTree, config, environmentId); addItemHashTree(postProcessor, samplerHashTree, config, environmentId);
} }
} else { } else {
if (!isPreScriptExecAfterPrivateScript && !globalPreScriptIsFilter && StringUtils.isNotEmpty(preProcessor.getScript())) { if (!isPreScriptExecAfterPrivateScript && !globalPreScriptIsFilter && preProcessor != null && StringUtils.isNotEmpty(preProcessor.getScript())) {
addItemHashTree(preProcessor, samplerHashTree, config, environmentId); addItemHashTree(preProcessor, samplerHashTree, config, environmentId);
} }
if (!isPostScriptExecAfterPrivateScript && !globalPostScriptIsFilter && StringUtils.isNotEmpty(postProcessor.getScript())) { if (!isPostScriptExecAfterPrivateScript && !globalPostScriptIsFilter && postProcessor != null && StringUtils.isNotEmpty(postProcessor.getScript())) {
addItemHashTree(postProcessor, samplerHashTree, config, environmentId); addItemHashTree(postProcessor, samplerHashTree, config, environmentId);
} }
} }