fix(测试计划): 同步关联接口/场景测试点
This commit is contained in:
parent
300545a4a5
commit
d52cace152
|
@ -590,7 +590,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
|
|||
if (selectAllModule) {
|
||||
// 选择了全部模块
|
||||
List<ApiTestCase> apiTestCaseList = extApiTestCaseMapper.selectAllApiCase(isRepeat, apiCase.getModules().getProjectId(), testPlan.getId());
|
||||
buildTestPlanApiCaseDTO(apiCase, apiTestCaseList, testPlan, user, testPlanApiCaseList);
|
||||
buildTestPlanApiCaseDTO(apiCase.getCollectionId(), apiTestCaseList, testPlan, user, testPlanApiCaseList);
|
||||
} else {
|
||||
AssociateCaseDTO dto = super.getCaseIds(moduleMaps);
|
||||
List<ApiTestCase> apiTestCaseList = new ArrayList<>();
|
||||
|
@ -614,7 +614,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
|
|||
|
||||
if (CollectionUtils.isNotEmpty(apiTestCaseList)) {
|
||||
List<ApiTestCase> list = apiTestCaseList.stream().sorted(Comparator.comparing(ApiTestCase::getPos).reversed()).toList();
|
||||
buildTestPlanApiCaseDTO(apiCase, list, testPlan, user, testPlanApiCaseList);
|
||||
buildTestPlanApiCaseDTO(apiCase.getCollectionId(), list, testPlan, user, testPlanApiCaseList);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
|
|||
if (selectAllModule) {
|
||||
// 选择了全部模块
|
||||
List<ApiTestCase> apiTestCaseList = extApiTestCaseMapper.selectAllApiCase(isRepeat, apiCase.getModules().getProjectId(), testPlan.getId());
|
||||
buildTestPlanApiCaseDTO(apiCase, apiTestCaseList, testPlan, user, testPlanApiCaseList);
|
||||
buildTestPlanApiCaseDTO(apiCase.getCollectionId(), apiTestCaseList, testPlan, user, testPlanApiCaseList);
|
||||
} else {
|
||||
AssociateCaseDTO dto = super.getCaseIds(moduleMaps);
|
||||
List<ApiTestCase> apiTestCaseList = new ArrayList<>();
|
||||
|
@ -656,7 +656,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
|
|||
|
||||
if (CollectionUtils.isNotEmpty(apiTestCaseList)) {
|
||||
List<ApiTestCase> list = apiTestCaseList.stream().sorted(Comparator.comparing(ApiTestCase::getPos).reversed()).toList();
|
||||
buildTestPlanApiCaseDTO(apiCase, list, testPlan, user, testPlanApiCaseList);
|
||||
buildTestPlanApiCaseDTO(apiCase.getCollectionId(), list, testPlan, user, testPlanApiCaseList);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -668,18 +668,18 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
|
|||
/**
|
||||
* 构建测试计划接口用例对象
|
||||
*
|
||||
* @param apiCase
|
||||
* @param collectionId
|
||||
* @param apiTestCaseList
|
||||
* @param testPlan
|
||||
* @param user
|
||||
* @param testPlanApiCaseList
|
||||
*/
|
||||
public void buildTestPlanApiCaseDTO(BaseCollectionAssociateRequest apiCase, List<ApiTestCase> apiTestCaseList, TestPlan testPlan, SessionUser user, List<TestPlanApiCase> testPlanApiCaseList) {
|
||||
AtomicLong nextOrder = new AtomicLong(getNextOrder(apiCase.getCollectionId()));
|
||||
public void buildTestPlanApiCaseDTO(String collectionId, List<ApiTestCase> apiTestCaseList, TestPlan testPlan, SessionUser user, List<TestPlanApiCase> testPlanApiCaseList) {
|
||||
AtomicLong nextOrder = new AtomicLong(getNextOrder(collectionId));
|
||||
apiTestCaseList.forEach(apiTestCase -> {
|
||||
TestPlanApiCase testPlanApiCase = new TestPlanApiCase();
|
||||
testPlanApiCase.setId(IDGenerator.nextStr());
|
||||
testPlanApiCase.setTestPlanCollectionId(apiCase.getCollectionId());
|
||||
testPlanApiCase.setTestPlanCollectionId(collectionId);
|
||||
testPlanApiCase.setTestPlanId(testPlan.getId());
|
||||
testPlanApiCase.setApiCaseId(apiTestCase.getId());
|
||||
testPlanApiCase.setEnvironmentId(apiTestCase.getEnvironmentId());
|
||||
|
|
|
@ -201,7 +201,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
|
|||
if (selectAllModule) {
|
||||
// 选择了全部模块
|
||||
List<ApiScenario> scenarioList = extApiScenarioMapper.selectAllCase(isRepeat, apiScenario.getModules().getProjectId(), testPlan.getId());
|
||||
buildTestPlanApiScenarioDTO(apiScenario, scenarioList, testPlan, user, testPlanApiScenarioList);
|
||||
buildTestPlanApiScenarioDTO(apiScenario.getCollectionId(), scenarioList, testPlan, user, testPlanApiScenarioList);
|
||||
} else {
|
||||
AssociateCaseDTO dto = super.getCaseIds(moduleMaps);
|
||||
List<ApiScenario> scenarioList = new ArrayList<>();
|
||||
|
@ -225,7 +225,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
|
|||
|
||||
if (CollectionUtils.isNotEmpty(scenarioList)) {
|
||||
List<ApiScenario> list = scenarioList.stream().sorted(Comparator.comparing(ApiScenario::getPos).reversed()).toList();
|
||||
buildTestPlanApiScenarioDTO(apiScenario, list, testPlan, user, testPlanApiScenarioList);
|
||||
buildTestPlanApiScenarioDTO(apiScenario.getCollectionId(), list, testPlan, user, testPlanApiScenarioList);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -236,20 +236,20 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
|
|||
/**
|
||||
* 构建测试计划场景用例对象
|
||||
*
|
||||
* @param apiScenario
|
||||
* @param collectionId
|
||||
* @param scenarioList
|
||||
* @param testPlan
|
||||
* @param user
|
||||
* @param testPlanApiScenarioList
|
||||
*/
|
||||
public void buildTestPlanApiScenarioDTO(BaseCollectionAssociateRequest apiScenario, List<ApiScenario> scenarioList, TestPlan testPlan, SessionUser user, List<TestPlanApiScenario> testPlanApiScenarioList) {
|
||||
AtomicLong nextOrder = new AtomicLong(getNextOrder(apiScenario.getCollectionId()));
|
||||
public void buildTestPlanApiScenarioDTO(String collectionId, List<ApiScenario> scenarioList, TestPlan testPlan, SessionUser user, List<TestPlanApiScenario> testPlanApiScenarioList) {
|
||||
AtomicLong nextOrder = new AtomicLong(getNextOrder(collectionId));
|
||||
scenarioList.forEach(scenario -> {
|
||||
TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario();
|
||||
testPlanApiScenario.setId(IDGenerator.nextStr());
|
||||
testPlanApiScenario.setTestPlanId(testPlan.getId());
|
||||
testPlanApiScenario.setApiScenarioId(scenario.getId());
|
||||
testPlanApiScenario.setTestPlanCollectionId(apiScenario.getCollectionId());
|
||||
testPlanApiScenario.setTestPlanCollectionId(collectionId);
|
||||
testPlanApiScenario.setGrouped(scenario.getGrouped());
|
||||
testPlanApiScenario.setEnvironmentId(scenario.getEnvironmentId());
|
||||
testPlanApiScenario.setCreateTime(System.currentTimeMillis());
|
||||
|
|
|
@ -866,7 +866,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
|||
List<String> caseIds = functionalCaseList.stream().map(FunctionalCase::getId).toList();
|
||||
List<ApiScenario> scenarioList = extFunctionalCaseTestMapper.selectApiScenarioByCaseIds(caseIds);
|
||||
List<TestPlanApiScenario> testPlanApiScenarioList = new ArrayList<>();
|
||||
testPlanApiScenarioService.buildTestPlanApiScenarioDTO(functional, scenarioList, testPlan, user, testPlanApiScenarioList);
|
||||
testPlanApiScenarioService.buildTestPlanApiScenarioDTO(functional.getModules().getApiScenarioCollectionId(), scenarioList, testPlan, user, testPlanApiScenarioList);
|
||||
if (CollectionUtils.isNotEmpty(testPlanApiScenarioList)) {
|
||||
testPlanApiScenarioMapper.batchInsert(testPlanApiScenarioList);
|
||||
}
|
||||
|
@ -886,7 +886,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
|||
List<String> caseIds = functionalCaseList.stream().map(FunctionalCase::getId).toList();
|
||||
List<ApiTestCase> apiTestCaseList = extFunctionalCaseTestMapper.selectApiCaseByCaseIds(caseIds);
|
||||
List<TestPlanApiCase> testPlanApiCaseList = new ArrayList<>();
|
||||
testPlanApiCaseService.buildTestPlanApiCaseDTO(functional, apiTestCaseList, testPlan, user, testPlanApiCaseList);
|
||||
testPlanApiCaseService.buildTestPlanApiCaseDTO(functional.getModules().getApiCaseCollectionId(), apiTestCaseList, testPlan, user, testPlanApiCaseList);
|
||||
if (CollectionUtils.isNotEmpty(testPlanApiCaseList)) {
|
||||
testPlanApiCaseMapper.batchInsert(testPlanApiCaseList);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue