fix(接口测试): 修复场景中的自定义请求步骤在某些条件下修改地址,不会覆盖到接口,也不会影响接口覆盖率的问题
--bug=1036522 --user=宋天阳 【接口测试】github#29161,场景用例中步骤的URI与接口定义一致,但接口覆盖率未统计到 https://www.tapd.cn/55049933/s/1468590
This commit is contained in:
parent
8a2b32b07f
commit
a6c5086e8a
|
@ -98,10 +98,25 @@ public class ApiScenarioReferenceIdService {
|
|||
if (item.has(MsHashTreeService.ID) && item.has(MsHashTreeService.REFERENCED)) {
|
||||
String url = null;
|
||||
String method;
|
||||
if (item.has(MsHashTreeService.PATH) && StringUtils.isNotEmpty(MsHashTreeService.PATH)) {
|
||||
url = item.optString(MsHashTreeService.PATH);
|
||||
} else if (item.has(MsHashTreeService.URL)) {
|
||||
url = item.optString(MsHashTreeService.URL);
|
||||
boolean customizeReq = item.optBoolean("customizeReq");
|
||||
|
||||
if (customizeReq) {
|
||||
/*
|
||||
判断是否是自定义请求。因为自定义请求中,针对”是否引用环境”字段的不同设置, 真正的url也会放在不同的字段中。
|
||||
据说这个功能是刚子写的。
|
||||
*/
|
||||
boolean isRefEnvironment = item.optBoolean("isRefEnvironment");
|
||||
if (isRefEnvironment) {
|
||||
url = item.optString(MsHashTreeService.PATH);
|
||||
} else {
|
||||
url = item.optString(MsHashTreeService.URL);
|
||||
}
|
||||
} else {
|
||||
if (item.has(MsHashTreeService.PATH) && StringUtils.isNotEmpty(MsHashTreeService.PATH)) {
|
||||
url = item.optString(MsHashTreeService.PATH);
|
||||
} else if (item.has(MsHashTreeService.URL)) {
|
||||
url = item.optString(MsHashTreeService.URL);
|
||||
}
|
||||
}
|
||||
method = this.getMethodFromSample(item);
|
||||
ApiScenarioReferenceId saveItem = new ApiScenarioReferenceId();
|
||||
|
|
Loading…
Reference in New Issue