fix(接口测试): 解决接口测试swagger2导入丢失描述问题以及查询待更新时间限制默认值问题

This commit is contained in:
guoyuqi 2022-10-11 19:42:47 +08:00 committed by xiaomeinvG
parent a4daad9c8a
commit 04e321d5ff
3 changed files with 12 additions and 11 deletions

View File

@ -133,6 +133,7 @@ public class Swagger2Parser extends SwaggerAbstractParser {
MsHTTPSamplerProxy request = buildRequest(operation, pathName, method.name());
request.setFollowRedirects(true);
ApiDefinitionWithBLOBs apiDefinition = buildApiDefinition(request.getId(), operation, pathName, method.name(), importRequest);
apiDefinition.setDescription(operation.getDescription());
parseParameters(operation, request);
addBodyHeader(request);
if (StringUtils.isNotBlank(basePath)) {

View File

@ -69,7 +69,6 @@ public class ApiTestCaseController {
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<ApiTestCaseDTO>> listSimple(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ApiTestCaseRequest request) {
apiTestCaseService.initRequestBySearch(request);
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
request.setSelectEnvironment(true);
return PageUtils.setPageInfo(page, apiTestCaseService.listSimple(request));

View File

@ -141,17 +141,21 @@ public class ApiTestCaseService {
}
public List<ApiTestCaseDTO> listSimple(ApiTestCaseRequest request) {
//工作台逻辑
initRequestBySearch(request);
request = this.initRequest(request, true, true);
List<ApiTestCaseDTO> apiTestCases = extApiTestCaseMapper.listSimple(request);
if (CollectionUtils.isEmpty(apiTestCases)) {
return apiTestCases;
}
buildUserInfo(apiTestCases, request.isSelectEnvironment());
return apiTestCases;
}
public Long getToBeUpdatedTime(String projectId) {
if (StringUtils.isBlank(projectId)) {
return getTimeMills(System.currentTimeMillis(), DEFAULT_TIME_DATE);
}
ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andTypeEqualTo(ProjectApplicationType.OPEN_UPDATE_TIME.name()).andProjectIdEqualTo(projectId);
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(example);
@ -1113,20 +1117,17 @@ public class ApiTestCaseService {
if (!request.isToBeUpdated()) {
return;
}
if (StringUtils.isBlank(request.getProjectId())) {
long toBeUpdatedTime = getTimeMills(System.currentTimeMillis(), DEFAULT_TIME_DATE);
request.setToBeUpdateTime(toBeUpdatedTime);
request.setUpdateTime(toBeUpdatedTime);
List<String> syncRuleCaseStatus = new ArrayList<>();
syncRuleCaseStatus.add(ApiReportStatus.ERROR.name());
request.setStatusList(syncRuleCaseStatus);
return;
}
Long toBeUpdatedTime = this.getToBeUpdatedTime(request.getProjectId());
if (toBeUpdatedTime != null) {
request.setToBeUpdateTime(toBeUpdatedTime);
request.setUpdateTime(toBeUpdatedTime);
}
if (StringUtils.isBlank(request.getProjectId())) {
List<String> syncRuleCaseStatus = new ArrayList<>();
syncRuleCaseStatus.add(ApiReportStatus.ERROR.name());
request.setStatusList(syncRuleCaseStatus);
return;
}
if (request.isNoSearchStatus()) {
request.setStatusList(new ArrayList<>());
} else {