fix(UI自动化): 测试计划UI报告未执行完毕不展示问题,失败停止发送消息统计数据错误问题

--bug=1016930 --user=张大海 【项目设置】消息通知,接口用例、场景、UI用例未执行数量显示错误,UI成功失败数量显示错误 https://www.tapd.cn/55049933/s/1248555
--bug=1016819 --user=张大海 【测试跟踪】测试计划里有UI用例,不过没执行,测试计划报告里就没显示UI用例 https://www.tapd.cn/55049933/s/1249382
This commit is contained in:
zhangdahai112 2022-09-21 20:35:00 +08:00 committed by zhangdahai112
parent 38e3cbd4a1
commit 4203cac5a1
3 changed files with 13 additions and 6 deletions

View File

@ -24,6 +24,7 @@ import io.metersphere.commons.utils.BeanUtils;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.constants.RunModeConstants;
import io.metersphere.constants.SystemConstants;
import io.metersphere.dto.ResultDTO;
import io.metersphere.dto.RunModeConfigDTO;
import io.metersphere.track.service.TestPlanReportService;
@ -222,9 +223,15 @@ public class ApiExecutionQueueService {
}
}
} else {
ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(executionQueue.getCompletedReportId());
if (result != null && StringUtils.equalsIgnoreCase(result.getStatus(), "Error")) {
isError = true;
if (StringUtils.startsWith(executionQueue.getRunMode(), SystemConstants.TestTypeEnum.UI.name())) {
//UI 失败停止
isError = ApiScenarioReportService.getUiErrorSize(dto) > 0;
} else {
ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(executionQueue.getCompletedReportId());
if (result != null && StringUtils.equalsIgnoreCase(result.getStatus(), "Error")) {
isError = true;
}
}
}
if (isError) {
@ -232,7 +239,7 @@ public class ApiExecutionQueueService {
example.createCriteria().andQueueIdEqualTo(dto.getQueueId());
if (StringUtils.isNotEmpty(dto.getTestPlanReportId())) {
CommonBeanFactory.getBean(TestPlanReportService.class).finishedTestPlanReport(dto.getTestPlanReportId(), "Stopped");
this.testPlanReportTestEnded(dto.getTestPlanReportId());
}
// 更新未执行的报告状态
List<ApiExecutionQueueDetail> details = executionQueueDetailMapper.selectByExample(example);

View File

@ -988,7 +988,7 @@ public class ApiScenarioReportService {
* @param dto
* @return
*/
private long getUiErrorSize(ResultDTO dto) {
public static long getUiErrorSize(ResultDTO dto) {
int errorSize = 0;
int successSize = 0;
try {

View File

@ -21,7 +21,7 @@
<ui-scenario-result :is-db="isDb" :share-id="shareId" :is-share="isShare"
:report="report" :is-template="isTemplate" :plan-id="planId"
:ui-all-cases="uiAllCases"
:filter-status="['unexecute']"
:filter-status="['unexecute', 'STOP']"
@setSize="setUnExecuteSize"/>
</el-tab-pane>