fix(接口测试): 修复接口/用例 环境模块匹配错误问题。
This commit is contained in:
parent
3d3b87949e
commit
16ac406fbd
|
@ -276,8 +276,8 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
if (httpConfig == null && !isURL(this.getUrl())) {
|
if (httpConfig == null && !isURL(this.getUrl())) {
|
||||||
MSException.throwException("未匹配到环境,请检查环境配置");
|
MSException.throwException("未匹配到环境,请检查环境配置");
|
||||||
}
|
}
|
||||||
if(StringUtils.isEmpty(httpConfig.getProtocol())){
|
if (StringUtils.isEmpty(httpConfig.getProtocol())) {
|
||||||
MSException.throwException(this.getName() +"接口,对应的环境无协议,请完善环境信息");
|
MSException.throwException(this.getName() + "接口,对应的环境无协议,请完善环境信息");
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(this.useEnvironment)) {
|
if (StringUtils.isEmpty(this.useEnvironment)) {
|
||||||
this.useEnvironment = config.getConfig().get(this.getProjectId()).getApiEnvironmentid();
|
this.useEnvironment = config.getConfig().get(this.getProjectId()).getApiEnvironmentid();
|
||||||
|
@ -398,6 +398,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载SSL认证
|
* 加载SSL认证
|
||||||
|
*
|
||||||
* @param config
|
* @param config
|
||||||
* @param httpSamplerTree
|
* @param httpSamplerTree
|
||||||
* @return
|
* @return
|
||||||
|
@ -454,6 +455,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义请求如果是完整url时不拼接mock信息
|
* 自定义请求如果是完整url时不拼接mock信息
|
||||||
|
*
|
||||||
* @param url
|
* @param url
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -461,7 +463,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
if (isCustomizeReq() && (url.startsWith("http://") || url.startsWith("https://"))) {
|
if (isCustomizeReq() && (url.startsWith("http://") || url.startsWith("https://"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 兼容旧数据
|
// 兼容旧数据
|
||||||
|
@ -622,12 +624,14 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (item.getType().equals(ConditionType.MODULE.name())) {
|
} else if (item.getType().equals(ConditionType.MODULE.name())) {
|
||||||
ApiDefinition apiDefinition;
|
ApiDefinition apiDefinition = null;
|
||||||
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||||
ApiTestCaseService apiTestCaseService = CommonBeanFactory.getBean(ApiTestCaseService.class);
|
ApiTestCaseService apiTestCaseService = CommonBeanFactory.getBean(ApiTestCaseService.class);
|
||||||
if (StringUtils.isNotEmpty(this.getReferenced()) && this.getReferenced().equals("REF") && StringUtils.isNotEmpty(this.getRefType()) && this.getRefType().equals("CASE")) {
|
if (StringUtils.isNotEmpty(this.getRefType()) && this.getRefType().equals("CASE")) {
|
||||||
ApiTestCaseWithBLOBs caseWithBLOBs = apiTestCaseService.get(this.getId());
|
ApiTestCaseWithBLOBs caseWithBLOBs = apiTestCaseService.get(this.getId());
|
||||||
apiDefinition = apiDefinitionService.get(caseWithBLOBs.getApiDefinitionId());
|
if (caseWithBLOBs != null) {
|
||||||
|
apiDefinition = apiDefinitionService.get(caseWithBLOBs.getApiDefinitionId());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
apiDefinition = apiDefinitionService.get(this.getId());
|
apiDefinition = apiDefinitionService.get(this.getId());
|
||||||
if (apiDefinition == null) {
|
if (apiDefinition == null) {
|
||||||
|
@ -702,7 +706,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<MsHTTPSamplerProxy> findHttpSampleFromHashTree(MsTestElement hashTree) {
|
public static List<MsHTTPSamplerProxy> findHttpSampleFromHashTree(MsTestElement hashTree) {
|
||||||
return findFromHashTreeByType(hashTree, MsHTTPSamplerProxy.class, null);
|
return findFromHashTreeByType(hashTree, MsHTTPSamplerProxy.class, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue