fix(接口测试): 修复tcp协议批量执行环境选择错误问题
--bug=1013593 --user=赵勇 【接口测试】TCP请求CASE,批量执行,没有带上环境信息 https://www.tapd.cn/55049933/s/1170150
This commit is contained in:
parent
cda010f76f
commit
d9773faeed
|
@ -159,7 +159,9 @@ public class MsTCPSampler extends MsTestElement {
|
|||
}
|
||||
if (config.getConfig() == null) {
|
||||
// 单独接口执行
|
||||
this.setProjectId(config.getProjectId());
|
||||
if(StringUtils.isNotEmpty(config.getProjectId())) {
|
||||
this.setProjectId(config.getProjectId());
|
||||
}
|
||||
config.setConfig(ElementUtil.getEnvironmentConfig(StringUtils.isNotEmpty(this.getEnvironmentId()) ? this.getEnvironmentId() : useEnvironment, this.getProjectId(), this.isMockEnvironment()));
|
||||
}
|
||||
EnvironmentConfig envConfig = null;
|
||||
|
|
|
@ -215,7 +215,7 @@ public class ApiScenarioSerialService {
|
|||
group.setName(runRequest.getReportId());
|
||||
group.setProjectId(caseWithBLOBs.getProjectId());
|
||||
|
||||
MsTestElement testElement = parse(data, testId, envId);
|
||||
MsTestElement testElement = parse(data, testId, envId, caseWithBLOBs.getProjectId());
|
||||
group.setHashTree(new LinkedList<>());
|
||||
group.getHashTree().add(testElement);
|
||||
testPlan.getHashTree().add(group);
|
||||
|
@ -235,7 +235,7 @@ public class ApiScenarioSerialService {
|
|||
return null;
|
||||
}
|
||||
|
||||
private MsTestElement parse(String api, String planId, String envId) {
|
||||
private MsTestElement parse(String api, String planId, String envId, String projectId) {
|
||||
try {
|
||||
JSONObject element = JSON.parseObject(api, Feature.DisableSpecialKeyDetect);
|
||||
ElementUtil.dataFormatting(element);
|
||||
|
@ -258,6 +258,9 @@ public class ApiScenarioSerialService {
|
|||
}
|
||||
if (element.getString("type").equals("TCPSampler")) {
|
||||
MsTCPSampler msTCPSampler = JSON.parseObject(api, MsTCPSampler.class, Feature.DisableSpecialKeyDetect);
|
||||
if (StringUtils.isEmpty(msTCPSampler.getProjectId())) {
|
||||
msTCPSampler.setProjectId(projectId);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(envId)) {
|
||||
msTCPSampler.setUseEnvironment(envId);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue