style(接口测试): 修复接口测试首页用例数量统计页签统计较慢的问题
--bug=1015401 --user=宋天阳 【接口测试】首页,接口用例数量加载的比较慢 https://www.tapd.cn/55049933/s/1215951
This commit is contained in:
parent
8a4035c530
commit
22ebbc5329
|
@ -204,35 +204,27 @@ public class APITestController {
|
|||
@GetMapping("/testCaseInfoCount/{projectId}")
|
||||
public ApiDataCountDTO testCaseInfoCount(@PathVariable String projectId) {
|
||||
ApiDataCountDTO apiCountResult = new ApiDataCountDTO();
|
||||
|
||||
List<ApiDataCountResult> countResultList = apiTestCaseService.countProtocolByProjectID(projectId);
|
||||
apiCountResult.countProtocal(countResultList);
|
||||
|
||||
long dateCountByCreateInThisWeek = apiTestCaseService.countByProjectIDAndCreateInThisWeek(projectId);
|
||||
apiCountResult.setThisWeekAddedCount(dateCountByCreateInThisWeek);
|
||||
|
||||
long executedInThisWeekCountNumber = apiDefinitionExecResultService.countByTestCaseIDInProjectAndExecutedInThisWeek(projectId);
|
||||
apiCountResult.setThisWeekExecutedCount(executedInThisWeekCountNumber);
|
||||
long executedCountNumber = apiDefinitionExecResultService.countByTestCaseIDInProject(projectId);
|
||||
apiCountResult.setExecutedCount(executedCountNumber);
|
||||
|
||||
//未覆盖 已覆盖: 统计当前接口下是否含有案例
|
||||
List<ApiDataCountResult> countResultByApiCoverageList = apiDefinitionService.countApiCoverageByProjectID(projectId);
|
||||
apiCountResult.countApiCoverage(countResultByApiCoverageList);
|
||||
long allCount = apiCountResult.getCoverageCount() + apiCountResult.getUncoverageCount();
|
||||
|
||||
if (allCount != 0) {
|
||||
float coverageRageNumber = (float) apiCountResult.getCoverageCount() * 100 / allCount;
|
||||
DecimalFormat df = new DecimalFormat("0.0");
|
||||
apiCountResult.setCoverageRage(df.format(coverageRageNumber) + "%");
|
||||
}
|
||||
|
||||
|
||||
apiCountResult.setHttpCountStr("HTTP <br/><br/>" + apiCountResult.getHttpApiDataCountNumber());
|
||||
apiCountResult.setRpcCountStr("RPC <br/><br/>" + apiCountResult.getRpcApiDataCountNumber());
|
||||
apiCountResult.setTcpCountStr("TCP <br/><br/>" + apiCountResult.getTcpApiDataCountNumber());
|
||||
apiCountResult.setSqlCountStr("SQL <br/><br/>" + apiCountResult.getSqlApiDataCountNumber());
|
||||
|
||||
//计算用例的通过率
|
||||
List<ExecuteResultCountDTO> apiCaseExecResultList = apiTestCaseService.selectExecuteResultByProjectId(projectId);
|
||||
long unexecuteCount = 0;
|
||||
|
|
|
@ -26,17 +26,20 @@
|
|||
<select id="countByProjectIDAndCreateInThisWeek" resultType="java.lang.Long">
|
||||
SELECT count(id) AS countNumber
|
||||
FROM api_case_execution_info
|
||||
WHERE source_id IN (
|
||||
WHERE (source_id IN (
|
||||
SELECT testCase.id
|
||||
FROM api_test_case testCase
|
||||
WHERE testCase.project_id = #{projectId}
|
||||
UNION
|
||||
SELECT id
|
||||
FROM test_plan_api_case
|
||||
WHERE api_case_id IN (SELECT testCase.id
|
||||
FROM api_test_case testCase
|
||||
WHERE testCase.project_id = #{projectId})
|
||||
)
|
||||
OR
|
||||
source_id IN (
|
||||
SELECT id
|
||||
FROM test_plan_api_case
|
||||
WHERE api_case_id IN (
|
||||
SELECT testCase.id
|
||||
FROM api_test_case testCase
|
||||
WHERE testCase.project_id = #{projectId})
|
||||
))
|
||||
AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
|
||||
</select>
|
||||
|
||||
|
@ -47,13 +50,13 @@
|
|||
SELECT testCase.id
|
||||
FROM api_test_case testCase
|
||||
WHERE testCase.project_id = #{projectId}
|
||||
UNION
|
||||
SELECT id
|
||||
FROM test_plan_api_case
|
||||
WHERE api_case_id IN (SELECT testCase.id
|
||||
FROM api_test_case testCase
|
||||
WHERE testCase.project_id = #{projectId})
|
||||
)
|
||||
OR source_id IN (SELECT id
|
||||
FROM test_plan_api_case
|
||||
WHERE api_case_id IN (
|
||||
SELECT testCase.id
|
||||
FROM api_test_case testCase
|
||||
WHERE testCase.project_id = #{projectId}))
|
||||
</select>
|
||||
|
||||
<select id="selectDistinctStatusByReportId" resultType="java.lang.String">
|
||||
|
|
Loading…
Reference in New Issue