fix(接口测试): 修复7天失败用例top10中统计错误的问题

--bug=1015093 --user=宋天阳 【测试跟踪】首页-过去7天测试计划失败用例top10,用例/场景失败次数没增加
https://www.tapd.cn/55049933/s/1206419
This commit is contained in:
song-tianyang 2022-07-21 16:19:36 +08:00 committed by 建国
parent 47b6b27edf
commit 78a3b307ff
2 changed files with 8 additions and 6 deletions

View File

@ -98,6 +98,7 @@ public class ApiDefinitionExecResultService {
if (!StringUtils.startsWithAny(item.getName(), "PRE_PROCESSOR_ENV_", "POST_PROCESSOR_ENV_")) {
ApiDefinitionExecResult result = this.editResult(item, dto.getReportId(), dto.getConsole(), dto.getRunMode(), dto.getTestId(), null);
if (result != null) {
result.setResourceId(dto.getTestId());
apiExecutionInfoService.insertExecutionInfo(result);
User user = null;
if (MapUtils.isNotEmpty(dto.getExtendedParameters())) {
@ -111,7 +112,6 @@ public class ApiDefinitionExecResultService {
}
}
// 发送通知
result.setResourceId(dto.getTestId());
LoggerUtil.info("执行结果【 " + result.getName() + " 】入库存储完成");
sendNotice(result, user);
}
@ -344,7 +344,7 @@ public class ApiDefinitionExecResultService {
triggerMode = reportResult.getTriggerMode();
}
if (MapUtils.isNotEmpty(expandDTO.getAttachInfoMap())) {
if (StringUtils.isNotEmpty(expandDTO.getStatus())) {
status = expandDTO.getStatus();
}
if (StringUtils.equalsAny(dto.getRunMode(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name())) {
@ -425,6 +425,7 @@ public class ApiDefinitionExecResultService {
try {
startTime = DateUtils.getDayStartTime(startDay);
} catch (Exception e) {
LogUtil.error("解析日期出错!", e);
}
if (startTime == null) {

View File

@ -94,15 +94,15 @@
testPlan.`name` AS testPlanName
FROM test_plan_api_scenario testPlanScenario
INNER JOIN test_plan testPlan ON testPlan.id = testPlanScenario.test_plan_id) apiScene
ON apiScene.id = executionInfo.source_id
INNER JOIN api_scenario scene ON scene.id = apiScene.api_scenario_id
ON apiScene.api_scenario_id = executionInfo.source_id
INNER JOIN api_scenario scene ON scene.id = executionInfo.source_id
WHERE scene.project_id = #{projectId}
AND scene.`status` != 'Trash'
AND ( executionInfo.result = 'Error' OR executionInfo.result = 'Fail' )
AND executionInfo.create_time >= #{startTimestamp}
GROUP BY
scene.id
scene.id,apiScene.testPlanId
<if test="selectFunctionCase == true">
UNION
SELECT
@ -440,7 +440,8 @@
#{id}
</foreach>
GROUP BY
resource_id )maxdata ON maxdata.resource_id = execResult.resource_id AND maxdata.create_time = execResult.create_time;
resource_id )maxdata ON maxdata.resource_id = execResult.resource_id AND maxdata.create_time =
execResult.create_time;
</select>