refactor(接口测试): 优化导出JMX全局前后置名称处理

--bug=1023228 --user=赵勇 【接口测试】导入附件中的脚本执行,步骤1和7执行了,但是报告里显示的是pending https://www.tapd.cn/55049933/s/1346067

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-03-07 14:27:10 +08:00 committed by fit2-zhao
parent ebe086fc0d
commit bccc995fd1
4 changed files with 11 additions and 2 deletions

View File

@ -10,9 +10,11 @@ import io.metersphere.base.domain.FileMetadata;
import io.metersphere.base.mapper.FileMetadataMapper; import io.metersphere.base.mapper.FileMetadataMapper;
import io.metersphere.commons.constants.ElementConstants; import io.metersphere.commons.constants.ElementConstants;
import io.metersphere.environment.service.BaseEnvironmentService; import io.metersphere.environment.service.BaseEnvironmentService;
import io.metersphere.i18n.Translator;
import io.metersphere.metadata.service.FileMetadataService; import io.metersphere.metadata.service.FileMetadataService;
import io.metersphere.request.BodyFile; import io.metersphere.request.BodyFile;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.jorphan.collections.HashTree; import org.apache.jorphan.collections.HashTree;
import org.aspectj.util.FileUtil; import org.aspectj.util.FileUtil;
@ -168,6 +170,8 @@ public class DataFormattingUtil {
jmx = StringUtils.replace(jmx, " guiclass=\"DubboSampleGui\" ", " guiclass=\"io.github.ningyu.jmeter.plugin.dubbo.gui.DubboSampleGui\" "); jmx = StringUtils.replace(jmx, " guiclass=\"DubboSampleGui\" ", " guiclass=\"io.github.ningyu.jmeter.plugin.dubbo.gui.DubboSampleGui\" ");
jmx = StringUtils.replace(jmx, " guiclass=\"DubboDefaultConfigGui\" ", " guiclass=\"io.github.ningyu.jmeter.plugin.dubbo.gui.DubboDefaultConfigGui\" "); jmx = StringUtils.replace(jmx, " guiclass=\"DubboDefaultConfigGui\" ", " guiclass=\"io.github.ningyu.jmeter.plugin.dubbo.gui.DubboDefaultConfigGui\" ");
jmx = StringUtils.replace(jmx, " testclass=\"DubboSample\" ", " testclass=\"io.github.ningyu.jmeter.plugin.dubbo.sample.DubboSample\" "); jmx = StringUtils.replace(jmx, " testclass=\"DubboSample\" ", " testclass=\"io.github.ningyu.jmeter.plugin.dubbo.sample.DubboSample\" ");
jmx = RegExUtils.replacePattern(jmx, "(PRE_PROCESSOR_ENV_false|PRE_PROCESSOR_ENV_true)", Translator.get("pre_processor_env"));
jmx = RegExUtils.replacePattern(jmx, "(POST_PROCESSOR_ENV_false|POST_PROCESSOR_ENV_true)", Translator.get("post_processor_env"));
} }
return jmx; return jmx;
} }

View File

@ -346,4 +346,6 @@ error_xml_struct=Data is not xml
case_name_is_already_exist=Duplicate Case name case_name_is_already_exist=Duplicate Case name
file_format_does_not_meet_requirements=File format does not meet requirements file_format_does_not_meet_requirements=File format does not meet requirements
url_is_not_valid=URL is not valid url_is_not_valid=URL is not valid
scenario_step_parsing_error_check=Scenario step parsing error, check if plugin step is included! scenario_step_parsing_error_check=Scenario step parsing error, check if plugin step is included!
pre_processor_env=global prescript
post_processor_env=global postscript

View File

@ -366,4 +366,5 @@ case_name_is_already_exist=用例名称不能重复
file_format_does_not_meet_requirements=文件格式不符合要求 file_format_does_not_meet_requirements=文件格式不符合要求
url_is_not_valid=URL 格式不正确! url_is_not_valid=URL 格式不正确!
scenario_step_parsing_error_check=场景步骤解析错误,请检查是否包含插件步骤! scenario_step_parsing_error_check=场景步骤解析错误,请检查是否包含插件步骤!
pre_processor_env=全局前置脚本
post_processor_env=全局后置脚本

View File

@ -366,3 +366,5 @@ case_name_is_already_exist=用例名稱不能重復
file_format_does_not_meet_requirements=文件格式不符合要求 file_format_does_not_meet_requirements=文件格式不符合要求
url_is_not_valid=URL 格式不正确! url_is_not_valid=URL 格式不正确!
scenario_step_parsing_error_check=場景步驟解析錯誤,檢查是否包含插件步驟! scenario_step_parsing_error_check=場景步驟解析錯誤,檢查是否包含插件步驟!
pre_processor_env=全局前置腳本
post_processor_env=全局後置腳本