fix(测试计划): 修复测试计划列表完成执行后执行状态错误
--bug=1015942 --user=刘瑶 【测试跟踪】github#16977,在测试计划列表列表中点击【执行】,完成执行后。该计划当前状态不对:测试进度非100%,但是当前状态为“完成”。 https://www.tapd.cn/55049933/s/1232711
This commit is contained in:
parent
f29d279e58
commit
d97ed8e0ae
|
@ -27,10 +27,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Collections;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@ -50,6 +47,8 @@ public class TestPlanMessageService {
|
||||||
@Resource
|
@Resource
|
||||||
private TestPlanReportService testPlanReportService;
|
private TestPlanReportService testPlanReportService;
|
||||||
|
|
||||||
|
public static final Integer FULL_MARKS = 100;
|
||||||
|
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
public void checkTestPlanStatusAndSendMessage(TestPlanReport report, TestPlanReportContentWithBLOBs testPlanReportContent, boolean sendMessage) {
|
public void checkTestPlanStatusAndSendMessage(TestPlanReport report, TestPlanReportContentWithBLOBs testPlanReportContent, boolean sendMessage) {
|
||||||
|
@ -93,15 +92,28 @@ public class TestPlanMessageService {
|
||||||
//通过率
|
//通过率
|
||||||
Double passRate = Optional.ofNullable(testPlanDTOWithMetric.getPassRate()).orElse(0.0);
|
Double passRate = Optional.ofNullable(testPlanDTOWithMetric.getPassRate()).orElse(0.0);
|
||||||
|
|
||||||
//只有通过率 与 测试进度 都为100% 才为已完成状态
|
// 已完成:测试进度=100% 且 通过率=100%
|
||||||
if (testRate >= 100 && passRate >= 100) {
|
if (testRate >= FULL_MARKS && passRate >= FULL_MARKS) {
|
||||||
return TestPlanStatus.Completed.name();
|
return TestPlanStatus.Completed.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 已结束:超过了计划结束时间(如有) 或 测试进度=100% 且 通过率非100%
|
||||||
|
Long plannedEndTime = testPlan.getPlannedEndTime();
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
if(Objects.nonNull(plannedEndTime) && currentTime >= plannedEndTime){
|
||||||
|
return TestPlanStatus.Finished.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(testRate >= FULL_MARKS && passRate < FULL_MARKS){
|
||||||
|
return TestPlanStatus.Finished.name();
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error("计算通过率失败!", e);
|
LogUtil.error("计算通过率失败!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TestPlanStatus.Finished.name();
|
// 进行中:0 < 测试进度 < 100%
|
||||||
|
return TestPlanStatus.Underway.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2280ac8d6679c9d5121264e166d79ae3e5af867c
|
Subproject commit 7cdda1b8f4554cb4185997d6a6beb2bc72809eed
|
|
@ -1 +1 @@
|
||||||
Subproject commit c5c6bd584e86f114705883e1b2986be19289c533
|
Subproject commit dc732de11799623169ffa05a230fc33540704a65
|
Loading…
Reference in New Issue