fix(接口测试): 修复场景导入在目标项目创建了CASE,但是场景中的步骤依然引用的是原场景所在项目中的CASE的问题

--bug=1048274 --user=宋天阳 【场景导入】-导出有使用CASE的场景后,在目标项目创建了CASE,但是场景中的步骤依然引用的是原场景所在项目中的CASE https://www.tapd.cn/55049933/s/1599925
This commit is contained in:
Jianguo-Genius 2024-10-29 11:15:04 +08:00 committed by 刘瑞斌
parent 0989b8ef37
commit d618593ffe
1 changed files with 4 additions and 2 deletions

View File

@ -980,10 +980,11 @@ public class ApiScenarioDataTransferService {
if (existenceApiCaseNumMap.containsKey(apiTestCaseDTO.getNum())) {
returnResource.putApiTestCase(apiTestCaseDTO.getId(), existenceApiCaseNumMap.get(apiTestCaseDTO.getNum()));
} else {
String oldId = apiTestCaseDTO.getId();
apiTestCaseDTO.setId(IDGenerator.nextStr());
apiTestCaseDTO.setProjectId(replaceApiDefinition.getProjectId());
apiTestCaseDTO.setApiDefinitionId(replaceApiDefinition.getId());
returnResource.putApiTestCase(apiTestCaseDTO.getId(), apiTestCaseDTO);
returnResource.putApiTestCase(oldId, apiTestCaseDTO);
analysisResult.setApiTestCase(apiTestCaseDTO);
}
}
@ -1003,10 +1004,11 @@ public class ApiScenarioDataTransferService {
analysisResult.setApiDefinition(apiDefinitionDetail);
for (ApiTestCaseDTO apiTestCaseDTO : testCaseList) {
String oldId = apiTestCaseDTO.getId();
apiTestCaseDTO.setId(IDGenerator.nextStr());
apiTestCaseDTO.setProjectId(apiDefinitionDetail.getProjectId());
apiTestCaseDTO.setApiDefinitionId(apiDefinitionDetail.getId());
returnResource.putApiTestCase(apiTestCaseDTO.getId(), apiTestCaseDTO);
returnResource.putApiTestCase(oldId, apiTestCaseDTO);
analysisResult.setApiTestCase(apiTestCaseDTO);
}
}