fix(测试跟踪): 用例导入更新没有触发重新提审

--bug=1037128 --user=陈建星 【测试跟踪】github#29396,【用例评审状态】本地用例“导入更新”后评审状态不会从“通过”变成“重新提审” https://www.tapd.cn/55049933/s/1518134
This commit is contained in:
AgAngle 2024-05-22 10:57:13 +08:00 committed by 刘瑞斌
parent 3b81f70c87
commit f84e8e00f8
1 changed files with 20 additions and 6 deletions

View File

@ -494,18 +494,30 @@ public class TestCaseService {
* 如果启用重新提审并且前置条件或步骤发生变化则触发重新提审 * 如果启用重新提审并且前置条件或步骤发生变化则触发重新提审
*/ */
private void reReviewTestReviewTestCase(TestCaseWithBLOBs originCase, TestCaseWithBLOBs testCase) { private void reReviewTestReviewTestCase(TestCaseWithBLOBs originCase, TestCaseWithBLOBs testCase) {
ProjectConfig config = baseProjectApplicationService.getProjectConfig(testCase.getProjectId()); boolean enAbleReReview = isEnAbleReReview(testCase.getProjectId());
Boolean reReview = config.getReReview(); reReviewTestReviewTestCase(originCase, testCase, enAbleReReview);
if (BooleanUtils.isTrue(reReview) && originCase != null) { }
private void reReviewTestReviewTestCase(TestCaseWithBLOBs originCase, TestCaseWithBLOBs testCase, boolean enAbleReReview) {
if (enAbleReReview && originCase != null) {
if (!StringUtils.equals(originCase.getPrerequisite(), testCase.getPrerequisite()) // 前置条件添加发生变化 if (!StringUtils.equals(originCase.getPrerequisite(), testCase.getPrerequisite()) // 前置条件添加发生变化
|| !StringUtils.equals(originCase.getSteps(), testCase.getSteps()) // 步骤发生变化 || (!StringUtils.equals(originCase.getSteps(), testCase.getSteps())
|| !StringUtils.equals(originCase.getStepDescription(), testCase.getStepDescription()) && !StringUtils.isAllBlank(originCase.getSteps(), testCase.getSteps())) // 这里null和空字符看作相等
|| !StringUtils.equals(originCase.getExpectedResult(), testCase.getExpectedResult())) { || (!StringUtils.equals(originCase.getStepDescription(), testCase.getStepDescription())
&& !StringUtils.isAllBlank(originCase.getStepDescription(), testCase.getStepDescription()))
|| (!StringUtils.equals(originCase.getExpectedResult(), testCase.getExpectedResult())
&& !StringUtils.isAllBlank(originCase.getExpectedResult(), testCase.getExpectedResult()))) {
testReviewTestCaseService.reReviewByCaseId(testCase.getId()); testReviewTestCaseService.reReviewByCaseId(testCase.getId());
} }
} }
} }
private boolean isEnAbleReReview(String projectId) {
ProjectConfig config = baseProjectApplicationService.getProjectConfig(projectId);
Boolean reReview = config.getReReview();
return BooleanUtils.isTrue(reReview);
}
/** /**
* 判断azure devops用例关联的需求是否发生变更若发生变更则重新建立需求与缺陷的关联关系 * 判断azure devops用例关联的需求是否发生变更若发生变更则重新建立需求与缺陷的关联关系
* *
@ -1436,6 +1448,7 @@ public class TestCaseService {
try { try {
if (!testCases.isEmpty()) { if (!testCases.isEmpty()) {
boolean enAbleReReview = isEnAbleReReview(request.getProjectId());
testCases.forEach(testCase -> { testCases.forEach(testCase -> {
testCase.setUpdateTime(System.currentTimeMillis()); testCase.setUpdateTime(System.currentTimeMillis());
testCase.setNodeId(nodePathMap.get(testCase.getNodePath())); testCase.setNodeId(nodePathMap.get(testCase.getNodePath()));
@ -1447,6 +1460,7 @@ public class TestCaseService {
} }
// 选了版本就更新到对应的版本 // 选了版本就更新到对应的版本
if (dbCase.getVersionId().equals(request.getVersionId())) { if (dbCase.getVersionId().equals(request.getVersionId())) {
reReviewTestReviewTestCase(testCaseMapper.selectByPrimaryKey(testCase.getId()), testCase, enAbleReReview);
mapper.updateByPrimaryKeySelective(testCase); mapper.updateByPrimaryKeySelective(testCase);
// 先删除 // 先删除