fix(接口测试): 测试计划用例单独执行,没有出现在任务中心
--bug=1047999 --user=陈建星 【系统设置】系统-任务中心-用例执行任务/用例执行任务详情列表-在测试计划内单独执行用例/场景-任务列表未显示该任务 https://www.tapd.cn/55049933/s/1597730
This commit is contained in:
parent
182c50fad1
commit
9250df2205
|
@ -710,57 +710,73 @@ public class ApiScenarioDataTransferService {
|
||||||
|
|
||||||
for (ApiScenarioImportDetail importScenario : analysisResult.getInsertApiScenarioData()) {
|
for (ApiScenarioImportDetail importScenario : analysisResult.getInsertApiScenarioData()) {
|
||||||
// 处理步骤里的关联资源文件
|
// 处理步骤里的关联资源文件
|
||||||
importScenario.getSteps().forEach(item -> {
|
List<ApiScenarioStepRequest> stepList = importScenario.getSteps();
|
||||||
if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API.name())) {
|
while (CollectionUtils.isNotEmpty(stepList)) {
|
||||||
ApiDefinitionDetail apiDetail = replaceScenarioResource.getApi(item.getResourceId());
|
List<ApiScenarioStepRequest> children = new ArrayList<>();
|
||||||
if (apiDetail != null) {
|
for (ApiScenarioStepRequest item : stepList) {
|
||||||
item.setResourceId(apiDetail.getId());
|
if (CollectionUtils.isNotEmpty(item.getChildren())) {
|
||||||
item.setProjectId(importScenario.getProjectId());
|
children.addAll(item.getChildren());
|
||||||
item.setOriginProjectId(apiDetail.getProjectId());
|
|
||||||
}
|
}
|
||||||
} else if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API_CASE.name())) {
|
if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API.name())) {
|
||||||
ApiTestCaseDTO newData = replaceScenarioResource.getApiCase(item.getResourceId());
|
ApiDefinitionDetail apiDetail = replaceScenarioResource.getApi(item.getResourceId());
|
||||||
if (newData != null) {
|
if (apiDetail != null) {
|
||||||
item.setResourceId(newData.getId());
|
item.setResourceId(apiDetail.getId());
|
||||||
item.setProjectId(importScenario.getProjectId());
|
item.setProjectId(importScenario.getProjectId());
|
||||||
item.setOriginProjectId(newData.getProjectId());
|
item.setOriginProjectId(apiDetail.getProjectId());
|
||||||
}
|
}
|
||||||
} else if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API_SCENARIO.name())) {
|
} else if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API_CASE.name())) {
|
||||||
ApiScenarioImportDetail newData = replaceScenarioResource.getApiScenario(item.getResourceId());
|
ApiTestCaseDTO newData = replaceScenarioResource.getApiCase(item.getResourceId());
|
||||||
if (newData != null) {
|
if (newData != null) {
|
||||||
item.setResourceId(newData.getId());
|
item.setResourceId(newData.getId());
|
||||||
item.setProjectId(importScenario.getProjectId());
|
item.setProjectId(importScenario.getProjectId());
|
||||||
item.setOriginProjectId(newData.getProjectId());
|
item.setOriginProjectId(newData.getProjectId());
|
||||||
|
}
|
||||||
|
} else if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API_SCENARIO.name())) {
|
||||||
|
ApiScenarioImportDetail newData = replaceScenarioResource.getApiScenario(item.getResourceId());
|
||||||
|
if (newData != null) {
|
||||||
|
item.setResourceId(newData.getId());
|
||||||
|
item.setProjectId(importScenario.getProjectId());
|
||||||
|
item.setOriginProjectId(newData.getProjectId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
stepList = children;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (ApiScenarioImportDetail updateScenario : analysisResult.getUpdateApiScenarioData()) {
|
for (ApiScenarioImportDetail updateScenario : analysisResult.getUpdateApiScenarioData()) {
|
||||||
// 处理步骤里的关联资源文件
|
// 处理步骤里的关联资源文件
|
||||||
updateScenario.getSteps().forEach(item -> {
|
List<ApiScenarioStepRequest> stepList = updateScenario.getSteps();
|
||||||
if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API.name())) {
|
while (CollectionUtils.isNotEmpty(stepList)) {
|
||||||
ApiDefinitionDetail apiDetail = replaceScenarioResource.getApi(item.getResourceId());
|
List<ApiScenarioStepRequest> children = new ArrayList<>();
|
||||||
if (apiDetail != null) {
|
for (ApiScenarioStepRequest item : stepList) {
|
||||||
item.setResourceId(apiDetail.getId());
|
if (CollectionUtils.isNotEmpty(item.getChildren())) {
|
||||||
item.setProjectId(updateScenario.getProjectId());
|
children.addAll(item.getChildren());
|
||||||
item.setOriginProjectId(apiDetail.getProjectId());
|
|
||||||
}
|
}
|
||||||
} else if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API_CASE.name())) {
|
if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API.name())) {
|
||||||
ApiTestCaseDTO newData = replaceScenarioResource.getApiCase(item.getResourceId());
|
ApiDefinitionDetail apiDetail = replaceScenarioResource.getApi(item.getResourceId());
|
||||||
if (newData != null) {
|
if (apiDetail != null) {
|
||||||
item.setResourceId(newData.getId());
|
item.setResourceId(apiDetail.getId());
|
||||||
item.setProjectId(updateScenario.getProjectId());
|
item.setProjectId(updateScenario.getProjectId());
|
||||||
item.setOriginProjectId(newData.getProjectId());
|
item.setOriginProjectId(apiDetail.getProjectId());
|
||||||
}
|
}
|
||||||
} else if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API_SCENARIO.name())) {
|
} else if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API_CASE.name())) {
|
||||||
ApiScenarioImportDetail newData = replaceScenarioResource.getApiScenario(item.getResourceId());
|
ApiTestCaseDTO newData = replaceScenarioResource.getApiCase(item.getResourceId());
|
||||||
if (newData != null) {
|
if (newData != null) {
|
||||||
item.setResourceId(newData.getId());
|
item.setResourceId(newData.getId());
|
||||||
item.setProjectId(updateScenario.getProjectId());
|
item.setProjectId(updateScenario.getProjectId());
|
||||||
item.setOriginProjectId(newData.getProjectId());
|
item.setOriginProjectId(newData.getProjectId());
|
||||||
|
}
|
||||||
|
} else if (StringUtils.equalsIgnoreCase(item.getStepType(), ApiScenarioStepType.API_SCENARIO.name())) {
|
||||||
|
ApiScenarioImportDetail newData = replaceScenarioResource.getApiScenario(item.getResourceId());
|
||||||
|
if (newData != null) {
|
||||||
|
item.setResourceId(newData.getId());
|
||||||
|
item.setProjectId(updateScenario.getProjectId());
|
||||||
|
item.setOriginProjectId(newData.getProjectId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
stepList = children;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return analysisResult;
|
return analysisResult;
|
||||||
}
|
}
|
||||||
|
@ -852,6 +868,7 @@ public class ApiScenarioDataTransferService {
|
||||||
Map<String, BaseTreeNode> modulePathMap = apiModules.stream().collect(Collectors.toMap(BaseTreeNode::getPath, k -> k, (k1, k2) -> k1));
|
Map<String, BaseTreeNode> modulePathMap = apiModules.stream().collect(Collectors.toMap(BaseTreeNode::getPath, k -> k, (k1, k2) -> k1));
|
||||||
for (ApiDefinitionDetail apiDefinitionDetail : analysisResult.getInsertApiDefinitions()) {
|
for (ApiDefinitionDetail apiDefinitionDetail : analysisResult.getInsertApiDefinitions()) {
|
||||||
List<BaseTreeNode> insertModuleList = TreeNodeParseUtils.getInsertNodeByPath(modulePathMap, apiDefinitionDetail.getModulePath());
|
List<BaseTreeNode> insertModuleList = TreeNodeParseUtils.getInsertNodeByPath(modulePathMap, apiDefinitionDetail.getModulePath());
|
||||||
|
apiDefinitionDetail.setModuleId(modulePathMap.get(apiDefinitionDetail.getModulePath()).getId());
|
||||||
insertModuleList.forEach(item -> item.setProjectId(targetProjectId));
|
insertModuleList.forEach(item -> item.setProjectId(targetProjectId));
|
||||||
analysisResult.getInsertApiModuleList().addAll(insertModuleList);
|
analysisResult.getInsertApiModuleList().addAll(insertModuleList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1849,7 +1849,7 @@ public class ApiScenarioService extends MoveNodeService {
|
||||||
returnList.addAll(this.parseConfig(steps, null));
|
returnList.addAll(this.parseConfig(steps, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ApiScenarioStepDTO> refScenarioSteps = steps.stream().filter(this::isRefOrPartialScenario).toList();
|
List<ApiScenarioStepDTO> refScenarioSteps = steps.stream().filter(k -> isScenarioStep(k.getStepType())).toList();
|
||||||
while (CollectionUtils.isNotEmpty(refScenarioSteps)) {
|
while (CollectionUtils.isNotEmpty(refScenarioSteps)) {
|
||||||
List<ApiScenarioStepDTO> childStep = new ArrayList<>();
|
List<ApiScenarioStepDTO> childStep = new ArrayList<>();
|
||||||
for (ApiScenarioStepDTO step : refScenarioSteps) {
|
for (ApiScenarioStepDTO step : refScenarioSteps) {
|
||||||
|
@ -1858,7 +1858,7 @@ public class ApiScenarioService extends MoveNodeService {
|
||||||
returnList.addAll(this.parseConfig(childStep, step.getId()));
|
returnList.addAll(this.parseConfig(childStep, step.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
refScenarioSteps = childStep.stream().filter(this::isRefOrPartialScenario).toList();
|
refScenarioSteps = childStep.stream().filter(k -> isScenarioStep(k.getStepType())).toList();
|
||||||
}
|
}
|
||||||
// 嵌套获取引用的场景步骤
|
// 嵌套获取引用的场景步骤
|
||||||
return returnList;
|
return returnList;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
:width="400"
|
:width="400"
|
||||||
>
|
>
|
||||||
<div class="mb-[16px] flex items-center gap-[8px]">
|
<div class="mb-[16px] flex items-center gap-[8px]">
|
||||||
<a-switch v-model:model-value="exportTypeRadio" type="line" size="small"></a-switch>
|
<a-switch v-model:model-value="exportTypeRadio" size="small"></a-switch>
|
||||||
{{ t('apiScenario.export.type.all') }}
|
{{ t('apiScenario.export.type.all') }}
|
||||||
<a-tooltip :content="t('apiScenario.export.simple.tooltip')" position="tl">
|
<a-tooltip :content="t('apiScenario.export.simple.tooltip')" position="tl">
|
||||||
<icon-question-circle
|
<icon-question-circle
|
||||||
|
|
Loading…
Reference in New Issue