fix(接口测试): 用例列表全选,批量同步,部分用例没有同步成功
--bug=1047132 --user=陈建星 【接口测试】CASE列表-批量选中case-同步成功,查看用例详情仍显示与定义不一致,实际是没同步成功 https://www.tapd.cn/55049933/s/1585866
This commit is contained in:
parent
86488f392d
commit
9386c45d33
|
@ -1044,7 +1044,7 @@ public class ApiTestCaseService extends MoveNodeService {
|
|||
AbstractMsTestElement apiMsTestElement = getApiMsTestElement(apiDefinitionBlob);
|
||||
ApiTestCaseBlob apiTestCaseBlob = apiTestCaseBlobMapper.selectByPrimaryKey(apiTestCase.getId());
|
||||
AbstractMsTestElement apiTestCaseMsTestElement = getTestElement(apiTestCaseBlob);
|
||||
boolean requestParamDifferent = HttpRequestParamDiffUtils.isRequestParamDiff(request.getSyncItems(), apiMsTestElement, apiTestCaseMsTestElement);
|
||||
boolean requestParamDifferent = HttpRequestParamDiffUtils.isRequestParamDiff(apiMsTestElement, apiTestCaseMsTestElement);
|
||||
if (requestParamDifferent) {
|
||||
// 如果参数与定义不一致,则同步参数,并记录日志和发送通知
|
||||
ApiTestCaseLogDTO originCase = BeanUtils.copyBean(new ApiTestCaseLogDTO(), apiTestCase);
|
||||
|
|
|
@ -33,10 +33,6 @@ import static io.metersphere.sdk.util.XMLUtils.elementToMap;
|
|||
public class HttpRequestParamDiffUtils {
|
||||
|
||||
public static boolean isRequestParamDiff(Object request1, Object request2) {
|
||||
return isRequestParamDiff(new ApiCaseSyncItemRequest(), request1, request2);
|
||||
}
|
||||
|
||||
public static boolean isRequestParamDiff(ApiCaseSyncItemRequest syncItemRequest, Object request1, Object request2) {
|
||||
if (!(request1 instanceof MsHTTPElement)) {
|
||||
// 其他协议不比较
|
||||
return false;
|
||||
|
@ -48,12 +44,6 @@ public class HttpRequestParamDiffUtils {
|
|||
boolean isHeaderDiff = isParamKeyDiff(httpElement1.getHeaders(), httpElement2.getHeaders());
|
||||
boolean isBodyDiff = isBodyDiff(httpElement1.getBody(), httpElement2.getBody());
|
||||
|
||||
// 设置需要同步的同步项, 减少比较次数
|
||||
syncItemRequest.setBody(isBodyDiff && BooleanUtils.isTrue(syncItemRequest.getBody()));
|
||||
syncItemRequest.setHeader(isHeaderDiff && BooleanUtils.isTrue(syncItemRequest.getHeader()));
|
||||
syncItemRequest.setQuery(isQueryDiff && BooleanUtils.isTrue(syncItemRequest.getQuery()));
|
||||
syncItemRequest.setRest(isRestDiff && BooleanUtils.isTrue(syncItemRequest.getRest()));
|
||||
|
||||
if (isQueryDiff || isRestDiff || isHeaderDiff || isBodyDiff) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue