fix(测试跟踪): 修复通过功能用例导入测试计划的其他用例没有环境导致无法运行问题
--bug=1020897--user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001020897
This commit is contained in:
parent
f5959f7363
commit
7dbef8d2a6
|
@ -158,6 +158,11 @@ public class TestPlanApiCaseController {
|
||||||
return testPlanApiCaseService.getApiCaseEnv(planId);
|
return testPlanApiCaseService.getApiCaseEnv(planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get/project/ids/{planId}")
|
||||||
|
public List<String> getApiCaseProjectIds(@PathVariable("planId") String planId) {
|
||||||
|
return testPlanApiCaseService.getApiCaseProjectIds(planId);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/is/executing/{planId}")
|
@GetMapping("/is/executing/{planId}")
|
||||||
public Boolean isExecuting(@PathVariable("planId") String planId) {
|
public Boolean isExecuting(@PathVariable("planId") String planId) {
|
||||||
return testPlanApiCaseService.isExecuting(planId);
|
return testPlanApiCaseService.isExecuting(planId);
|
||||||
|
|
|
@ -175,6 +175,11 @@ public class TestPlanScenarioCaseController {
|
||||||
return testPlanScenarioCaseService.getApiScenarioEnv(planId);
|
return testPlanScenarioCaseService.getApiScenarioEnv(planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get/project/ids/{planId}")
|
||||||
|
public List<String> getApiScenarioProjectIds(@PathVariable("planId") String planId) {
|
||||||
|
return testPlanScenarioCaseService.getApiScenarioProjectIds(planId);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/plan/report")
|
@PostMapping("/plan/report")
|
||||||
public ApiPlanReportDTO buildApiReport(@RequestBody ApiPlanReportRequest request) {
|
public ApiPlanReportDTO buildApiReport(@RequestBody ApiPlanReportRequest request) {
|
||||||
return testPlanScenarioCaseService.buildApiReport(request);
|
return testPlanScenarioCaseService.buildApiReport(request);
|
||||||
|
|
|
@ -817,4 +817,18 @@ public class TestPlanApiCaseService {
|
||||||
List<ApiDefinitionExecResultWithBLOBs> results = apiDefinitionExecResultMapper.selectByExampleWithBLOBs(example);
|
List<ApiDefinitionExecResultWithBLOBs> results = apiDefinitionExecResultMapper.selectByExampleWithBLOBs(example);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getApiCaseProjectIds(String planId) {
|
||||||
|
TestPlanApiCaseExample caseExample = new TestPlanApiCaseExample();
|
||||||
|
caseExample.createCriteria().andTestPlanIdEqualTo(planId);
|
||||||
|
List<TestPlanApiCase> testPlanApiCases = testPlanApiCaseMapper.selectByExample(caseExample);
|
||||||
|
List<String> apiCaseIds = testPlanApiCases.stream().map(TestPlanApiCase::getApiCaseId).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(apiCaseIds)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
ApiTestCaseExample example = new ApiTestCaseExample();
|
||||||
|
example.createCriteria().andIdIn(apiCaseIds);
|
||||||
|
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
|
||||||
|
return apiTestCases.stream().map(ApiTestCase::getProjectId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1245,4 +1245,18 @@ public class TestPlanScenarioCaseService {
|
||||||
public String selectProjectId(String testPlanId) {
|
public String selectProjectId(String testPlanId) {
|
||||||
return extTestPlanScenarioCaseMapper.selectProjectId(testPlanId);
|
return extTestPlanScenarioCaseMapper.selectProjectId(testPlanId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getApiScenarioProjectIds(String planId) {
|
||||||
|
TestPlanApiScenarioExample scenarioExample = new TestPlanApiScenarioExample();
|
||||||
|
scenarioExample.createCriteria().andTestPlanIdEqualTo(planId);
|
||||||
|
List<TestPlanApiScenario> testPlanApiScenarios = testPlanApiScenarioMapper.selectByExample(scenarioExample);
|
||||||
|
List<String> scenarioIds = testPlanApiScenarios.stream().map(TestPlanApiScenario::getApiScenarioId).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(scenarioIds)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
ApiScenarioExample example = new ApiScenarioExample();
|
||||||
|
example.createCriteria().andIdIn(scenarioIds);
|
||||||
|
List<ApiScenario> apiScenarios = apiScenarioMapper.selectByExample(example);
|
||||||
|
return apiScenarios.stream().map(ApiScenario::getProjectId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,6 +227,11 @@ public class TestPlanController {
|
||||||
return testPlanService.getPlanCaseEnv(plan.getId());
|
return testPlanService.getPlanCaseEnv(plan.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/case/relevance/project/ids")
|
||||||
|
public List<String> getRelevanceProjectIds(@RequestBody TestPlan plan) {
|
||||||
|
return testPlanService.getRelevanceProjectIds(plan.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/edit/run/config")
|
@PostMapping("/edit/run/config")
|
||||||
public void updateRunModeConfig(@RequestBody TestPlanRunRequest testplanRunRequest) {
|
public void updateRunModeConfig(@RequestBody TestPlanRunRequest testplanRunRequest) {
|
||||||
|
|
|
@ -2059,7 +2059,7 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
if (serviceIdSet.contains(MicroServiceName.UI_TEST)) {
|
if (serviceIdSet.contains(MicroServiceName.UI_TEST)) {
|
||||||
List<UiScenarioReportWithBLOBs> apiDefinitionLists = planTestPlanUiScenarioCaseService.selectExtForPlanReport(reportId);
|
List<UiScenarioReportWithBLOBs> apiDefinitionLists = planTestPlanUiScenarioCaseService.selectExtForPlanReport(reportId);
|
||||||
if(CollectionUtils.isNotEmpty(apiDefinitionLists)){
|
if (CollectionUtils.isNotEmpty(apiDefinitionLists)) {
|
||||||
UiScenarioReportWithBLOBs apiDefinition = apiDefinitionLists.get(0);
|
UiScenarioReportWithBLOBs apiDefinition = apiDefinitionLists.get(0);
|
||||||
convertEnvConfig(apiDefinition.getEnvConfig(), testPlanExtReportDTO);
|
convertEnvConfig(apiDefinition.getEnvConfig(), testPlanExtReportDTO);
|
||||||
getResourcePool(apiDefinition.getActuator(), testPlanExtReportDTO);
|
getResourcePool(apiDefinition.getActuator(), testPlanExtReportDTO);
|
||||||
|
@ -2068,4 +2068,17 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
return testPlanExtReportDTO;
|
return testPlanExtReportDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getRelevanceProjectIds(String planId) {
|
||||||
|
List<String> projectIds = new ArrayList<>();
|
||||||
|
List<String> apiCaseProjectIds = planTestPlanApiCaseService.getApiCaseProjectIds(planId);
|
||||||
|
List<String> apiScenarioProjectIds = planTestPlanScenarioCaseService.getApiScenarioProjectIds(planId);
|
||||||
|
if (DiscoveryUtil.hasService(MicroServiceName.UI_TEST)) {
|
||||||
|
List<String> uiScenarioProjectIds = planTestPlanUiScenarioCaseService.getUiScenarioProjectIds(planId);
|
||||||
|
projectIds.addAll(uiScenarioProjectIds);
|
||||||
|
}
|
||||||
|
projectIds.addAll(apiCaseProjectIds);
|
||||||
|
projectIds.addAll(apiScenarioProjectIds);
|
||||||
|
return projectIds.stream().distinct().collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,10 @@ public class PlanTestPlanApiCaseService extends ApiTestService {
|
||||||
return (Map<String, List<String>>) microService.getForData(serviceName, BASE_UEL + "/get/env/" + planId);
|
return (Map<String, List<String>>) microService.getForData(serviceName, BASE_UEL + "/get/env/" + planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getApiCaseProjectIds(String planId) {
|
||||||
|
return (List<String>) microService.getForData(serviceName, BASE_UEL + "/get/project/ids/" + planId);
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean isCaseExecuting(String planId) {
|
public Boolean isCaseExecuting(String planId) {
|
||||||
return (Boolean) microService.getForData(serviceName, BASE_UEL + "/is/executing/" + planId);
|
return (Boolean) microService.getForData(serviceName, BASE_UEL + "/is/executing/" + planId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,6 +143,10 @@ public class PlanTestPlanScenarioCaseService extends ApiTestService {
|
||||||
return microService.getForData(serviceName, BASE_UEL + "/get/env/" + planId, Map.class);
|
return microService.getForData(serviceName, BASE_UEL + "/get/env/" + planId, Map.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getApiScenarioProjectIds(String planId) {
|
||||||
|
return microService.getForData(serviceName, BASE_UEL + "/get/project/ids/" + planId, List.class);
|
||||||
|
}
|
||||||
|
|
||||||
public ApiPlanReportDTO getApiReport(ApiPlanReportRequest request) {
|
public ApiPlanReportDTO getApiReport(ApiPlanReportRequest request) {
|
||||||
return microService.postForData(serviceName, BASE_UEL + "/plan/report", request, ApiPlanReportDTO.class);
|
return microService.postForData(serviceName, BASE_UEL + "/plan/report", request, ApiPlanReportDTO.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,4 +157,8 @@ public class PlanTestPlanUiScenarioCaseService extends UiTestService {
|
||||||
public Map<String, List<String>> getUiScenarioEnv(String planId) {
|
public Map<String, List<String>> getUiScenarioEnv(String planId) {
|
||||||
return microService.getForData(serviceName, BASE_URL + "/get/env/" + planId, Map.class);
|
return microService.getForData(serviceName, BASE_URL + "/get/env/" + planId, Map.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getUiScenarioProjectIds(String planId) {
|
||||||
|
return microService.getForData(serviceName, BASE_URL + "/get/project/ids/" + planId, List.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,12 +289,16 @@ export function updateSchedule(param){
|
||||||
return post(BASE_URL + 'schedule/update',param);
|
return post(BASE_URL + 'schedule/update',param);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getApiScenarioEnv(param){
|
export function getApiScenarioEnv(param) {
|
||||||
return post(BASE_URL + 'api/scenario/env',param);
|
return post(BASE_URL + 'api/scenario/env', param);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPlanCaseEnv(param){
|
export function getPlanCaseEnv(param) {
|
||||||
return post(BASE_URL + 'case/env',param);
|
return post(BASE_URL + 'case/env', param);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPlanCaseProjectIds(param) {
|
||||||
|
return post(BASE_URL + 'case/relevance/project/ids', param);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function run(testId, reportId) {
|
export function run(testId, reportId) {
|
||||||
|
|
|
@ -200,7 +200,7 @@ import {getCurrentProjectID, getOwnerProjects} from "@/business/utils/sdk-utils"
|
||||||
import {getQuotaValidResourcePools} from "@/api/remote/resource-pool";
|
import {getQuotaValidResourcePools} from "@/api/remote/resource-pool";
|
||||||
import EnvGroupPopover from "@/business/plan/env/EnvGroupPopover";
|
import EnvGroupPopover from "@/business/plan/env/EnvGroupPopover";
|
||||||
import {getApiCaseEnv} from "@/api/remote/plan/test-plan-api-case";
|
import {getApiCaseEnv} from "@/api/remote/plan/test-plan-api-case";
|
||||||
import {getApiScenarioEnv, getPlanCaseEnv} from "@/api/remote/plan/test-plan";
|
import {getApiScenarioEnv, getPlanCaseEnv, getPlanCaseProjectIds} from "@/api/remote/plan/test-plan";
|
||||||
import EnvGroupWithOption from "../env/EnvGroupWithOption";
|
import EnvGroupWithOption from "../env/EnvGroupWithOption";
|
||||||
import EnvironmentGroup from "@/business/plan/env/EnvironmentGroupList";
|
import EnvironmentGroup from "@/business/plan/env/EnvironmentGroupList";
|
||||||
import EnvSelectPopover from "@/business/plan/env/EnvSelectPopover";
|
import EnvSelectPopover from "@/business/plan/env/EnvSelectPopover";
|
||||||
|
@ -402,9 +402,23 @@ export default {
|
||||||
this.projectIds.add(d);
|
this.projectIds.add(d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$refs.envSelectPopover.open();
|
if (this.projectIds.size === 0) {
|
||||||
|
param = {id: this.planId};
|
||||||
|
getPlanCaseProjectIds(param).then((res) => {
|
||||||
|
let data = res.data;
|
||||||
|
if (data) {
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
this.projectIds.add(data[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$refs.envSelectPopover.open();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$refs.envSelectPopover.open();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
handleCommand(command) {
|
handleCommand(command) {
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in New Issue