fix(测试跟踪): 只有测试计划执行的权限,执行关联接口的功能用例会权限错误
--bug=1032874 --user=陈建星 有测试计划执行的权限,无法执行功能用例 https://www.tapd.cn/55049933/s/1436100
This commit is contained in:
parent
f912c5c0b8
commit
3cb5202f98
|
@ -327,25 +327,37 @@ public class TestPlanTestCaseService {
|
|||
switch (type) {
|
||||
case "performance":
|
||||
if (serviceIdSet.contains(MicroServiceName.PERFORMANCE_TEST)) {
|
||||
LoadTest loadTest = planPerformanceTestService.get(id);
|
||||
if (loadTest != null) {
|
||||
dto.setTestName(loadTest.getName());
|
||||
try {
|
||||
LoadTest loadTest = planPerformanceTestService.get(id);
|
||||
if (loadTest != null) {
|
||||
dto.setTestName(loadTest.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "testcase":
|
||||
if (serviceIdSet.contains(MicroServiceName.API_TEST)) {
|
||||
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = planApiTestCaseService.get(id);
|
||||
if (apiTestCaseWithBLOBs != null) {
|
||||
dto.setTestName(apiTestCaseWithBLOBs.getName());
|
||||
try {
|
||||
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = planApiTestCaseService.get(id);
|
||||
if (apiTestCaseWithBLOBs != null) {
|
||||
dto.setTestName(apiTestCaseWithBLOBs.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "automation":
|
||||
if (serviceIdSet.contains(MicroServiceName.API_TEST)) {
|
||||
ApiScenarioWithBLOBs apiScenarioWithBLOBs = panApiAutomationService.get(id);
|
||||
if (apiScenarioWithBLOBs != null) {
|
||||
dto.setTestName(apiScenarioWithBLOBs.getName());
|
||||
try {
|
||||
ApiScenarioWithBLOBs apiScenarioWithBLOBs = panApiAutomationService.get(id);
|
||||
if (apiScenarioWithBLOBs != null) {
|
||||
dto.setTestName(apiScenarioWithBLOBs.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -2846,29 +2846,41 @@ public class TestCaseService {
|
|||
List<UiScenario> uiScenarios = new ArrayList<>();
|
||||
|
||||
if (serviceIdSet.contains(MicroServiceName.API_TEST)) {
|
||||
apiCases = relevanceApiCaseService.getApiCaseByIds(
|
||||
getTestIds(testCaseTests, TestCaseTestType.testcase.name()));
|
||||
apiScenarios = relevanceApiCaseService.getScenarioCaseByIds(
|
||||
getTestIds(testCaseTests, TestCaseTestType.automation.name()));
|
||||
projectIds.addAll(apiCases.stream().map(s -> s.getProjectId()).collect(Collectors.toList()));
|
||||
scenarioProjectIds = apiScenarios.stream().map(s -> s.getProjectId()).distinct().collect(Collectors.toList());
|
||||
projectIds.addAll(scenarioProjectIds);
|
||||
versionIds.addAll(apiCases.stream().map(s -> s.getVersionId()).collect(Collectors.toList()));
|
||||
versionIds.addAll(apiScenarios.stream().map(s -> s.getVersionId()).collect(Collectors.toList()));
|
||||
try {
|
||||
apiCases = relevanceApiCaseService.getApiCaseByIds(
|
||||
getTestIds(testCaseTests, TestCaseTestType.testcase.name()));
|
||||
apiScenarios = relevanceApiCaseService.getScenarioCaseByIds(
|
||||
getTestIds(testCaseTests, TestCaseTestType.automation.name()));
|
||||
projectIds.addAll(apiCases.stream().map(s -> s.getProjectId()).collect(Collectors.toList()));
|
||||
scenarioProjectIds = apiScenarios.stream().map(s -> s.getProjectId()).distinct().collect(Collectors.toList());
|
||||
projectIds.addAll(scenarioProjectIds);
|
||||
versionIds.addAll(apiCases.stream().map(s -> s.getVersionId()).collect(Collectors.toList()));
|
||||
versionIds.addAll(apiScenarios.stream().map(s -> s.getVersionId()).collect(Collectors.toList()));
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (serviceIdSet.contains(MicroServiceName.PERFORMANCE_TEST)) {
|
||||
apiLoadTests = relevanceLoadCaseService.getLoadCaseByIds(
|
||||
getTestIds(testCaseTests, TestCaseTestType.performance.name()));
|
||||
projectIds.addAll(apiLoadTests.stream().map(s -> s.getProjectId()).collect(Collectors.toList()));
|
||||
versionIds.addAll(apiLoadTests.stream().map(l -> l.getVersionId()).collect(Collectors.toList()));
|
||||
try {
|
||||
apiLoadTests = relevanceLoadCaseService.getLoadCaseByIds(
|
||||
getTestIds(testCaseTests, TestCaseTestType.performance.name()));
|
||||
projectIds.addAll(apiLoadTests.stream().map(s -> s.getProjectId()).collect(Collectors.toList()));
|
||||
versionIds.addAll(apiLoadTests.stream().map(l -> l.getVersionId()).collect(Collectors.toList()));
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (serviceIdSet.contains(MicroServiceName.UI_TEST)) {
|
||||
uiScenarios = relevanceUiCaseService.getUiCaseByIds(
|
||||
getTestIds(testCaseTests, TestCaseTestType.uiAutomation.name()));
|
||||
projectIds.addAll(uiScenarios.stream().map(s -> s.getProjectId()).collect(Collectors.toList()));
|
||||
versionIds.addAll(uiScenarios.stream().map(l -> l.getVersionId()).collect(Collectors.toList()));
|
||||
try {
|
||||
uiScenarios = relevanceUiCaseService.getUiCaseByIds(
|
||||
getTestIds(testCaseTests, TestCaseTestType.uiAutomation.name()));
|
||||
projectIds.addAll(uiScenarios.stream().map(s -> s.getProjectId()).collect(Collectors.toList()));
|
||||
versionIds.addAll(uiScenarios.stream().map(l -> l.getVersionId()).collect(Collectors.toList()));
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue