fix(接口测试): 场景执行模块匹配不上执行报错

This commit is contained in:
AgAngle 2024-03-20 10:44:06 +08:00 committed by 刘瑞斌
parent 50b96bbc97
commit 62197311ae
3 changed files with 7 additions and 0 deletions

View File

@ -21,14 +21,17 @@ import java.util.LinkedList;
public abstract class AbstractMsTestElement implements MsTestElement {
/**
* 步骤ID唯一
* 运行时设置
*/
private String stepId;
/**
* 关联的资源ID用例ID/接口ID/场景ID)
* 运行时设置
*/
private String resourceId;
/**
* 当前的项目ID
* 运行时设置
*/
private String projectId;
/**

View File

@ -499,6 +499,7 @@ public class ApiExecuteService {
apiCommonService.setEnableCommonScriptProcessorInfo(testElement);
testElement.setResourceId(taskRequest.getResourceId());
testElement.setStepId(taskRequest.getResourceId());
testElement.setProjectId(taskRequest.getProjectId());
return execute(runRequest, taskRequest, apiParamConfig);
}

View File

@ -597,6 +597,9 @@ public class ApiTestCaseService extends MoveNodeService {
.collect(Collectors.toMap(ApiTestCase::getApiDefinitionId, ApiTestCase::getId));
List<String> definitionIds = apiCaseDefinitionMap.keySet().stream().collect(Collectors.toList());
if (CollectionUtils.isEmpty(definitionIds)) {
return List.of();
}
List<ApiResourceModuleInfo> moduleInfos = extApiDefinitionMapper.getModuleInfoByIds(definitionIds);
// resourceId 从定义ID替换成用例ID
moduleInfos.forEach(moduleInfo ->