fix(测试计划): 修复复制计划组时没有同步复制计划组配置的缺陷

This commit is contained in:
Jianguo-Genius 2024-06-19 18:28:27 +08:00 committed by Craftsman
parent c399d27c1f
commit 64a2cb00d9
6 changed files with 20 additions and 11 deletions

View File

@ -158,7 +158,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
newCase.setCreateTime(operatorTime);
newCase.setCreateUser(operator);
newCase.setLastExecTime(0L);
newCase.setLastExecResult(null);
newCase.setLastExecResult(ExecStatus.PENDING.name());
newCase.setLastExecReportId(null);
copyList.add(newCase);
});

View File

@ -149,7 +149,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
newCase.setCreateTime(operatorTime);
newCase.setCreateUser(operator);
newCase.setLastExecTime(0L);
newCase.setLastExecResult(null);
newCase.setLastExecResult(ExecStatus.PENDING.name());
newCase.setLastExecReportId(null);
copyList.add(newCase);
});

View File

@ -266,6 +266,15 @@ public class TestPlanBatchOperationService extends TestPlanBaseUtilsService {
testPlanGroup.setStatus(TestPlanConstants.TEST_PLAN_STATUS_PREPARED);
testPlanMapper.insert(testPlanGroup);
//测试配置信息
TestPlanConfig originalTestPlanConfig = testPlanConfigMapper.selectByPrimaryKey(originalGroup.getId());
if (originalTestPlanConfig != null) {
TestPlanConfig newTestPlanConfig = new TestPlanConfig();
BeanUtils.copyBean(newTestPlanConfig, originalTestPlanConfig);
newTestPlanConfig.setTestPlanId(testPlanGroup.getId());
testPlanConfigMapper.insertSelective(newTestPlanConfig);
}
for (TestPlan child : childList) {
copyPlan(child, testPlanGroup.getId(), TestPlanConstants.TEST_PLAN_TYPE_GROUP, operatorTime, operator);
}

View File

@ -136,7 +136,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
newCase.setCreateTime(operatorTime);
newCase.setCreateUser(operator);
newCase.setLastExecTime(0L);
newCase.setLastExecResult(null);
newCase.setLastExecResult(ExecStatus.PENDING.name());
copyList.add(newCase);
});

View File

@ -423,7 +423,7 @@ public class TestPlanService extends TestPlanBaseUtilsService {
//测试计划组归档
updateGroupStatus(testPlan.getId(), userId);
//关闭定时任务
this.deleteScheduleConfig(testPlan.getId());
} else if (StringUtils.equals(testPlan.getStatus(), TestPlanConstants.TEST_PLAN_STATUS_COMPLETED) && StringUtils.equalsIgnoreCase(testPlan.getGroupId(), TestPlanConstants.TEST_PLAN_DEFAULT_GROUP_ID)) {
//测试计划
testPlan.setStatus(TestPlanConstants.TEST_PLAN_STATUS_ARCHIVED);
@ -476,6 +476,7 @@ public class TestPlanService extends TestPlanBaseUtilsService {
if (CollectionUtils.isEmpty(ids)) {
throw new MSException(Translator.get("test_plan.group.not_plan"));
}
ids.add(id);
extTestPlanMapper.batchUpdateStatus(TestPlanConstants.TEST_PLAN_STATUS_ARCHIVED, userId, System.currentTimeMillis(), ids);
}
@ -747,7 +748,7 @@ public class TestPlanService extends TestPlanBaseUtilsService {
* @param tags
*/
private void checkTagsLength(List<String> tags) {
if (tags.size() > MAX_TAG_SIZE) {
if (CollectionUtils.size(tags) > MAX_TAG_SIZE) {
throw new MSException(Translator.getWithArgs("tags_length_large_than", String.valueOf(MAX_TAG_SIZE)));
}
}

View File

@ -1175,6 +1175,11 @@ public class TestPlanTests extends BaseTest {
this.requestPostWithOk(URL_POST_TEST_PLAN_UPDATE, updateRequest);
a2NodeCount--;
TestPlan updatePlan = new TestPlan();
updatePlan.setId(groupTestPlanId7);
updatePlan.setStatus(TestPlanConstants.TEST_PLAN_STATUS_UNDERWAY);
testPlanMapper.updateByPrimaryKeySelective(updatePlan);
//修改测试计划组信息
updateRequest = testPlanTestService.generateUpdateRequest(groupTestPlanId7);
updateRequest.setName(IDGenerator.nextStr());
@ -2189,12 +2194,6 @@ public class TestPlanTests extends BaseTest {
String returnId2 = holder2.getData().toString();
Assertions.assertNotNull(returnId2);
//4.计划组 有计划
MvcResult mvcResult3 = this.requestGetWithOkAndReturn(String.format(URL_TEST_PLAN_COPY, "wx_test_plan_id_5"));
String returnStr3 = mvcResult3.getResponse().getContentAsString();
ResultHolder holder3 = JSON.parseObject(returnStr3, ResultHolder.class);
String returnId3 = holder3.getData().toString();
Assertions.assertNotNull(returnId3);
}
@Test