fix(接口测试): 修复场景步骤单步调试无法使用环境变量问题

--bug=1021620 --user=赵勇 【接口测试】github#21116,接口自动化场景中,单独执行用例 不能调用环境变量,旧版本是正常的 https://www.tapd.cn/55049933/s/1323348
This commit is contained in:
fit2-zhao 2023-01-06 09:36:04 +08:00 committed by fit2-zhao
parent 662787156d
commit 84ea8bf112
3 changed files with 5 additions and 4 deletions

View File

@ -127,7 +127,8 @@ public class MsScenario extends MsTestElement {
// 这里加入自定义变量解决ForEach循环控制器取值问题循环控制器无法从vars中取值
if (BooleanUtils.isTrue(this.variableEnable) || BooleanUtils.isTrue(this.mixEnable)) {
scenarioTree.add(ElementUtil.argumentsToUserParameters(valueSupposeMock));
} else if (config != null && StringUtils.equals(this.getId(), config.getScenarioId())) {
} else if (config != null
&& (StringUtils.equals(this.getId(), config.getScenarioId()) || config.isApi())) {
scenarioTree.add(valueSupposeMock);
}
}

View File

@ -92,7 +92,7 @@ public class ParameterConfig extends MsParameter {
private boolean runLocal;
private String browserLanguage;
private boolean isApi;
/**
* 排除生成临界控制器的场景
*/

View File

@ -204,7 +204,7 @@ public class ApiExecuteService {
private JmeterRunRequestDTO initRunRequest(RunDefinitionRequest request, List<MultipartFile> bodyFiles) {
ParameterConfig config = new ParameterConfig();
config.setProjectId(request.getProjectId());
config.setApi(true);
Map<String, EnvironmentConfig> envConfig = new HashMap<>();
Map<String, String> map = request.getEnvironmentMap();
if (map != null && map.size() > 0) {
@ -308,7 +308,7 @@ public class ApiExecuteService {
BaseEnvironmentService apiTestEnvironmentService = CommonBeanFactory.getBean(BaseEnvironmentService.class);
ApiTestEnvironmentWithBLOBs environment = apiTestEnvironmentService.get(request.getEnvironmentId());
ParameterConfig parameterConfig = new ParameterConfig();
parameterConfig.setApi(true);
Map<String, EnvironmentConfig> envConfig = new HashMap<>(16);
if (environment != null && environment.getConfig() != null) {
EnvironmentConfig environmentConfig = JSONUtil.parseObject(environment.getConfig(), EnvironmentConfig.class);