fix(接口测试): 修复测试计划的执行数据会被接口统计到的问题
--bug=1019780 --user=宋天阳 【接口测试】首页 - 场景用例数量统计 - 执行次数统计,在测试计划中执行场景也会统计到接口模块 https://www.tapd.cn/55049933/s/1298691
This commit is contained in:
parent
c66cf14ee8
commit
fe254b8e92
|
@ -20,9 +20,9 @@ public interface ExtApiScenarioReportMapper {
|
||||||
|
|
||||||
long countByProjectID(String projectId);
|
long countByProjectID(String projectId);
|
||||||
|
|
||||||
long countByProjectIdAndCreateInThisWeek(@Param("projectId") String projectId, @Param("version") String version, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
long countByProjectIdAndCreateInThisWeek(@Param("projectId") String projectId, @Param("executeType") String executeType, @Param("version") String version, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||||
|
|
||||||
long countByProjectIdAndCreateAndByScheduleInThisWeek(@Param("projectId") String projectId, @Param("version") String version, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
long countByProjectIdAndCreateAndByScheduleInThisWeek(@Param("projectId") String projectId, @Param("executeType") String executeType, @Param("version") String version, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||||
|
|
||||||
List<ApiDataCountResult> countByProjectIdGroupByExecuteResult(@Param("projectId") String projectId, @Param("version") String version);
|
List<ApiDataCountResult> countByProjectIdGroupByExecuteResult(@Param("projectId") String projectId, @Param("version") String version);
|
||||||
|
|
||||||
|
|
|
@ -362,6 +362,10 @@
|
||||||
<if test="version != null">
|
<if test="version != null">
|
||||||
AND version = #{version}
|
AND version = #{version}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="executeType != null">
|
||||||
|
AND execute_type = #{executeType}
|
||||||
|
</if>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="countByProjectIdAndCreateAndByScheduleInThisWeek" resultType="java.lang.Long">
|
<select id="countByProjectIdAndCreateAndByScheduleInThisWeek" resultType="java.lang.Long">
|
||||||
|
@ -371,6 +375,9 @@
|
||||||
AND project_id = #{projectId}
|
AND project_id = #{projectId}
|
||||||
<if test="version != null">
|
<if test="version != null">
|
||||||
AND version = #{version}
|
AND version = #{version}
|
||||||
|
</if>
|
||||||
|
<if test="executeType != null">
|
||||||
|
AND execute_type = #{executeType}
|
||||||
</if>
|
</if>
|
||||||
AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -144,10 +144,10 @@ public class ApiHomeController {
|
||||||
//统计覆盖率
|
//统计覆盖率
|
||||||
long dateCountByCreateInThisWeek = apiAutomationService.countScenarioByProjectIDAndCreatInThisWeek(projectId);
|
long dateCountByCreateInThisWeek = apiAutomationService.countScenarioByProjectIDAndCreatInThisWeek(projectId);
|
||||||
apiCountResult.setCreatedInWeek(dateCountByCreateInThisWeek);
|
apiCountResult.setCreatedInWeek(dateCountByCreateInThisWeek);
|
||||||
long executedInThisWeekCountNumber = apiScenarioReportService.countByProjectIdAndCreateInThisWeek(projectId, null);
|
long executedInThisWeekCountNumber = apiScenarioReportService.countByProjectIdAndCreateInThisWeek(projectId, ExecutionExecuteTypeEnum.BASIC.name(), null);
|
||||||
apiCountResult.setExecutedTimesInWeek(executedInThisWeekCountNumber);
|
apiCountResult.setExecutedTimesInWeek(executedInThisWeekCountNumber);
|
||||||
//所有执行次数
|
//所有执行次数
|
||||||
long executedTimes = apiAutomationService.countExecuteTimesByProjectID(projectId, null, null);
|
long executedTimes = apiAutomationService.countExecuteTimesByProjectID(projectId, null, ExecutionExecuteTypeEnum.BASIC.name(), null);
|
||||||
apiCountResult.setExecutedTimes(executedTimes);
|
apiCountResult.setExecutedTimes(executedTimes);
|
||||||
//未执行、未通过、已通过
|
//未执行、未通过、已通过
|
||||||
List<ApiDataCountResult> countResultByRunResult = apiAutomationService.countRunResultByProjectID(projectId);
|
List<ApiDataCountResult> countResultByRunResult = apiAutomationService.countRunResultByProjectID(projectId);
|
||||||
|
@ -188,9 +188,9 @@ public class ApiHomeController {
|
||||||
apiCountResult.setTotal(allTaskCount);
|
apiCountResult.setTotal(allTaskCount);
|
||||||
long taskCountInThisWeek = baseScheduleService.countTaskByProjectIdInThisWeek(projectId);
|
long taskCountInThisWeek = baseScheduleService.countTaskByProjectIdInThisWeek(projectId);
|
||||||
apiCountResult.setCreatedInWeek(taskCountInThisWeek);
|
apiCountResult.setCreatedInWeek(taskCountInThisWeek);
|
||||||
long executedInThisWeekCountNumber = apiScenarioReportService.countByProjectIdAndCreateAndByScheduleInThisWeek(projectId, null);
|
long executedInThisWeekCountNumber = apiScenarioReportService.countByProjectIdAndCreateAndByScheduleInThisWeek(projectId, ExecutionExecuteTypeEnum.BASIC.name(), null);
|
||||||
apiCountResult.setExecutedTimesInWeek(executedInThisWeekCountNumber);
|
apiCountResult.setExecutedTimesInWeek(executedInThisWeekCountNumber);
|
||||||
long executedTimes = apiAutomationService.countExecuteTimesByProjectID(projectId, ReportTriggerMode.SCHEDULE.name(), null);
|
long executedTimes = apiAutomationService.countExecuteTimesByProjectID(projectId, ReportTriggerMode.SCHEDULE.name(), ExecutionExecuteTypeEnum.BASIC.name(), null);
|
||||||
apiCountResult.setExecutedTimes(executedTimes);
|
apiCountResult.setExecutedTimes(executedTimes);
|
||||||
//统计 失败 成功 以及总数
|
//统计 失败 成功 以及总数
|
||||||
List<ApiDataCountResult> allExecuteResult = apiScenarioReportService.countByProjectIdGroupByExecuteResult(projectId, null);
|
List<ApiDataCountResult> allExecuteResult = apiScenarioReportService.countByProjectIdGroupByExecuteResult(projectId, null);
|
||||||
|
@ -233,7 +233,7 @@ public class ApiHomeController {
|
||||||
|
|
||||||
@GetMapping("/failure/case/about/plan/{projectId}/{selectFunctionCase}/{limitNumber}/{goPage}/{pageSize}")
|
@GetMapping("/failure/case/about/plan/{projectId}/{selectFunctionCase}/{limitNumber}/{goPage}/{pageSize}")
|
||||||
public Pager<List<ExecutedCaseInfoDTO>> failureCaseAboutTestPlan(@PathVariable String projectId, @PathVariable boolean selectFunctionCase,
|
public Pager<List<ExecutedCaseInfoDTO>> failureCaseAboutTestPlan(@PathVariable String projectId, @PathVariable boolean selectFunctionCase,
|
||||||
@PathVariable int limitNumber, @PathVariable int goPage, @PathVariable int pageSize) {
|
@PathVariable int limitNumber, @PathVariable int goPage, @PathVariable int pageSize) {
|
||||||
|
|
||||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||||
List<ExecutedCaseInfoResult> selectDataList = apiDefinitionExecResultService.findFailureCaseInfoByProjectIDAndLimitNumberInSevenDays(projectId, selectFunctionCase, limitNumber);
|
List<ExecutedCaseInfoResult> selectDataList = apiDefinitionExecResultService.findFailureCaseInfoByProjectIDAndLimitNumberInSevenDays(projectId, selectFunctionCase, limitNumber);
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class ApiScenarioExecutionInfoService {
|
||||||
scenarioExecutionInfoMapper.deleteByExample(example);
|
scenarioExecutionInfoMapper.deleteByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countExecuteTimesByProjectID(String projectId, String triggerMode, String version) {
|
public long countExecuteTimesByProjectID(String projectId, String triggerMode, String executeType, String version) {
|
||||||
ScenarioExecutionInfoExample example = new ScenarioExecutionInfoExample();
|
ScenarioExecutionInfoExample example = new ScenarioExecutionInfoExample();
|
||||||
ScenarioExecutionInfoExample.Criteria criteria = example.createCriteria();
|
ScenarioExecutionInfoExample.Criteria criteria = example.createCriteria();
|
||||||
criteria.andProjectIdEqualTo(projectId);
|
criteria.andProjectIdEqualTo(projectId);
|
||||||
|
@ -101,6 +101,9 @@ public class ApiScenarioExecutionInfoService {
|
||||||
if (StringUtils.isNotEmpty(version)) {
|
if (StringUtils.isNotEmpty(version)) {
|
||||||
criteria.andVersionEqualTo(version);
|
criteria.andVersionEqualTo(version);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotEmpty(executeType)) {
|
||||||
|
criteria.andExecuteTypeEqualTo(executeType);
|
||||||
|
}
|
||||||
return scenarioExecutionInfoMapper.countByExample(example);
|
return scenarioExecutionInfoMapper.countByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -718,7 +718,7 @@ public class ApiScenarioReportService {
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countByProjectIdAndCreateAndByScheduleInThisWeek(String projectId, String version) {
|
public long countByProjectIdAndCreateAndByScheduleInThisWeek(String projectId, String executeType, String version) {
|
||||||
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||||
|
|
||||||
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
||||||
|
@ -727,11 +727,11 @@ public class ApiScenarioReportService {
|
||||||
if (firstTime == null || lastTime == null) {
|
if (firstTime == null || lastTime == null) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return extApiScenarioReportMapper.countByProjectIdAndCreateAndByScheduleInThisWeek(projectId, version, firstTime.getTime(), lastTime.getTime());
|
return extApiScenarioReportMapper.countByProjectIdAndCreateAndByScheduleInThisWeek(projectId, executeType, version, firstTime.getTime(), lastTime.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countByProjectIdAndCreateInThisWeek(String projectId, String version) {
|
public long countByProjectIdAndCreateInThisWeek(String projectId, String executeType, String version) {
|
||||||
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||||
|
|
||||||
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
||||||
|
@ -740,7 +740,7 @@ public class ApiScenarioReportService {
|
||||||
if (firstTime == null || lastTime == null) {
|
if (firstTime == null || lastTime == null) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return extApiScenarioReportMapper.countByProjectIdAndCreateInThisWeek(projectId, version, firstTime.getTime(), lastTime.getTime());
|
return extApiScenarioReportMapper.countByProjectIdAndCreateInThisWeek(projectId, executeType, version, firstTime.getTime(), lastTime.getTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2010,8 +2010,8 @@ public class ApiScenarioService {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countExecuteTimesByProjectID(String projectId, String triggerMode, String version) {
|
public long countExecuteTimesByProjectID(String projectId, String triggerMode, String executeType, String version) {
|
||||||
return scenarioExecutionInfoService.countExecuteTimesByProjectID(projectId, triggerMode, version);
|
return scenarioExecutionInfoService.countExecuteTimesByProjectID(projectId, triggerMode, executeType, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue