fix(接口测试): 修复接口用例按照执行状态查询时对停止状态的数据归类错误的问题

修复接口用例按照执行状态查询时对停止状态的数据归类错误的问题
This commit is contained in:
song-tianyang 2022-09-22 15:15:45 +08:00 committed by 建国
parent 6a12064421
commit 3a29a3c71c
2 changed files with 13 additions and 12 deletions

View File

@ -234,7 +234,7 @@ public class APITestController {
for (ExecuteResultCountDTO execResult : apiCaseExecResultList) {
if (StringUtils.isEmpty(execResult.getExecResult())) {
unexecuteCount += execResult.getCount();
} else if (StringUtils.equalsAnyIgnoreCase(execResult.getExecResult(), "Underway", ExecuteResult.TEST_PLAN_PREPARE.toString())) {
} else if (StringUtils.equalsAnyIgnoreCase(execResult.getExecResult(), "Underway", ExecuteResult.STOP.toString(), ExecuteResult.TEST_PLAN_PREPARE.toString())) {
unexecuteCount += execResult.getCount();
} else if (StringUtils.equalsIgnoreCase(execResult.getExecResult(), ExecuteResult.API_SUCCESS.toString())) {
executionPassCount += execResult.getCount();

View File

@ -446,19 +446,19 @@
</foreach>
</if>
<if test="request.redirectFilter == 'unexecuteCount' ">
and (t1.status IS NULL or t1.status = '' or t1.status = 'Prepare' or t1.status = 'Underway')
and (t3.status IS NULL or t3.status = '' or t3.status = 'Prepare' or t3.status = 'Underway' or t3.status = 'stop')
</if>
<if test="request.redirectFilter == 'executionPassCount' ">
and t1.status = 'success'
and t3.status = 'success'
</if>
<if test="request.redirectFilter == 'executionFailedCount' ">
and t1.status = 'error'
and t3.status = 'error'
</if>
<if test="request.redirectFilter == 'fakeErrorCount' ">
and t1.status = 'errorReportResult'
and t3.status = 'errorReportResult'
</if>
<if test="request.redirectFilter == 'notSuccessCount' ">
and t1.status IN ('error','errorReportResult')
and t3.status IN ('error','errorReportResult')
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
@ -982,15 +982,16 @@
<select id="selectExecuteResultByProjectId"
resultType="io.metersphere.api.dto.datacount.response.ExecuteResultCountDTO">
SELECT status AS execResult, count(id) AS `count`
FROM api_test_case
WHERE project_id = #{0}
AND (`status` IS NULL OR `status` != 'Trash')
AND api_definition_id IN (SELECT id
SELECT t3.status AS execResult, count(t1.id) AS `count`
FROM api_test_case t1
LEFT JOIN api_definition_exec_result t3 ON t1.last_result_id = t3.id
WHERE t1.project_id = #{0}
AND (t1.`status` IS NULL OR t1.`status` != 'Trash')
AND t1.api_definition_id IN (SELECT id
FROM api_definition
WHERE project_id = #{0}
AND latest = 1)
GROUP BY `status`
GROUP BY t3.`status`
</select>
<select id="caseList" resultType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
SELECT