fix(接口测试): 优化接口忽略接口参数变更通知接口
--task=1015861 --user=陈建星 【接口测试】接口用例支持同步更新接口变更-是否与定义不一致查询接口 https://www.tapd.cn/55049933/s/1557706
This commit is contained in:
parent
e1e1a36d9b
commit
5ecbefb884
|
@ -319,11 +319,11 @@ public class ApiTestCaseController {
|
|||
}
|
||||
|
||||
@GetMapping("/api-change/ignore/{id}")
|
||||
@Operation(summary = "清除接口参数变更标识")
|
||||
@Operation(summary = "忽略接口变更提示")
|
||||
@RequiresPermissions(logical = Logical.OR, value = {PermissionConstants.PROJECT_API_DEFINITION_CASE_ADD, PermissionConstants.PROJECT_API_DEFINITION_CASE_UPDATE})
|
||||
@CheckOwner(resourceId = "#id", resourceType = "api_test_case")
|
||||
public void ignoreApiChange(@PathVariable String id) {
|
||||
apiTestCaseService.ignoreApiChange(id);
|
||||
public void ignoreApiChange(@PathVariable String id, @RequestParam(name = "ignore") boolean ignore) {
|
||||
apiTestCaseService.ignoreApiChange(id, ignore);
|
||||
}
|
||||
|
||||
@GetMapping("/api/compare/{id}")
|
||||
|
|
|
@ -101,6 +101,9 @@ public class ApiTestCaseDTO {
|
|||
@Schema(description = "与接口定义不一致")
|
||||
private Boolean inconsistentWithApi;
|
||||
|
||||
@Schema(description = "忽略接口与用例参数不一致")
|
||||
private Boolean ignoreApiDiff;
|
||||
|
||||
@Schema(description = "忽略接口定义参数变更")
|
||||
private Boolean ignoreApiChange;
|
||||
}
|
||||
|
|
|
@ -980,13 +980,17 @@ public class ApiTestCaseService extends MoveNodeService {
|
|||
return ApiDataUtils.parseObject(new String(apiTestCaseBlob.getRequest()), AbstractMsTestElement.class);
|
||||
}
|
||||
|
||||
public void ignoreApiChange(String id) {
|
||||
public void ignoreApiChange(String id, boolean ignore) {
|
||||
checkResourceExist(id);
|
||||
ApiTestCase apiTestCase = new ApiTestCase();
|
||||
apiTestCase.setId(id);
|
||||
apiTestCase.setApiChange(false);
|
||||
apiTestCase.setIgnoreApiDiff(true);
|
||||
apiTestCase.setIgnoreApiChange(true);
|
||||
if (ignore) {
|
||||
apiTestCase.setApiChange(false);
|
||||
apiTestCase.setIgnoreApiDiff(true);
|
||||
apiTestCase.setIgnoreApiChange(true);
|
||||
} else {
|
||||
apiTestCase.setIgnoreApiChange(false);
|
||||
}
|
||||
apiTestCaseMapper.updateByPrimaryKeySelective(apiTestCase);
|
||||
}
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
|||
private static final String RUN_POST = "run";
|
||||
private static final String BATCH_RUN = "batch/run";
|
||||
private static final String API_CHANGE_CLEAR = "api-change/clear/{0}";
|
||||
private static final String API_CHANGE_IGNORE = "api-change/ignore/{0}";
|
||||
private static final String API_CHANGE_IGNORE = "api-change/ignore/{0}?ignore={1}";
|
||||
private static final String API_CHANGE_SYNC = "batch/api-change/sync";
|
||||
private static final String API_COMPARE = "api/compare/{0}";
|
||||
|
||||
|
@ -478,14 +478,18 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
|||
updateCase.setApiChange(true);
|
||||
updateCase.setId(apiTestCase.getId());
|
||||
apiTestCaseMapper.updateByPrimaryKeySelective(updateCase);
|
||||
this.requestGetWithOk(API_CHANGE_IGNORE, apiTestCase.getId());
|
||||
this.requestGetWithOk(API_CHANGE_IGNORE, apiTestCase.getId(), true);
|
||||
Assertions.assertFalse(apiTestCaseMapper.selectByPrimaryKey(apiTestCase.getId()).getApiChange());
|
||||
Assertions.assertTrue(apiTestCaseMapper.selectByPrimaryKey(apiTestCase.getId()).getIgnoreApiDiff());
|
||||
Assertions.assertTrue(apiTestCaseMapper.selectByPrimaryKey(apiTestCase.getId()).getIgnoreApiChange());
|
||||
this.requestGetWithOk(API_CHANGE_IGNORE, apiTestCase.getId(), false);
|
||||
Assertions.assertFalse(apiTestCaseMapper.selectByPrimaryKey(apiTestCase.getId()).getApiChange());
|
||||
Assertions.assertTrue(apiTestCaseMapper.selectByPrimaryKey(apiTestCase.getId()).getIgnoreApiDiff());
|
||||
Assertions.assertFalse(apiTestCaseMapper.selectByPrimaryKey(apiTestCase.getId()).getIgnoreApiChange());
|
||||
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_ADD, API_CHANGE_IGNORE, apiTestCase.getId());
|
||||
requestGetPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_UPDATE, API_CHANGE_IGNORE, apiTestCase.getId());
|
||||
requestGetPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_ADD, API_CHANGE_IGNORE, apiTestCase.getId(), true);
|
||||
requestGetPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_CASE_UPDATE, API_CHANGE_IGNORE, apiTestCase.getId(), false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue