feat(测试计划): 重复关联的空状态用例统计有误

--bug=1042584 --user=宋昌昌 【测试计划】计划组中的子计划关联了重复的接口用例,执行报告中去重执行了 https://www.tapd.cn/55049933/s/1531827
This commit is contained in:
song-cc-rock 2024-06-19 16:22:53 +08:00 committed by 刘瑞斌
parent 6867bd97dd
commit 8fd70d8479
3 changed files with 22 additions and 19 deletions

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.plan.mapper.ExtTestPlanReportApiCaseMapper"> <mapper namespace="io.metersphere.plan.mapper.ExtTestPlanReportApiCaseMapper">
<select id="countExecuteResult" resultType="io.metersphere.plan.dto.CaseStatusCountMap"> <select id="countExecuteResult" resultType="io.metersphere.plan.dto.CaseStatusCountMap">
select tprac.api_case_execute_result as status, count(id) as count from test_plan_report_api_case tprac select ifnull(tprac.api_case_execute_result, 'PENDING') as status, count(id) as count from test_plan_report_api_case tprac
where tprac.test_plan_report_id = #{id} where tprac.test_plan_report_id = #{id}
group by tprac.api_case_execute_result group by tprac.api_case_execute_result
</select> </select>
@ -25,10 +25,10 @@
</select> </select>
<select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO"> <select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO">
<!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数 --> <!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数、 接口报告ID -->
select distinct tprac.api_case_id as id, tprac.api_case_num as num, tprac.api_case_name as name, select tprac.api_case_id as id, tprac.api_case_num as num, tprac.api_case_name as name,
tprac.api_case_module as moduleName, tprac.api_case_priority as priority, tprac.api_case_execute_report_id reportId, tprac.api_case_module as moduleName, tprac.api_case_priority as priority, tprac.api_case_execute_report_id reportId,
tprac.api_case_execute_result as executeResult, tprac.api_case_execute_user as executeUser, 0 as bugCount ifnull(tprac.api_case_execute_result, 'PENDING') as executeResult, tprac.api_case_execute_user as executeUser, 0 as bugCount
from test_plan_report_api_case tprac from test_plan_report_api_case tprac
where tprac.test_plan_report_id = #{request.reportId} where tprac.test_plan_report_id = #{request.reportId}
<include refid="filter"/> <include refid="filter"/>
@ -45,11 +45,12 @@
<foreach collection="request.filter.entrySet()" index="key" item="values"> <foreach collection="request.filter.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0"> <if test="values != null and values.size() > 0">
<choose> <choose>
<!-- 执行状态 --> <!-- 执行结果 -->
<when test="key == 'executeResult'"> <when test="key == 'executeResult'">
and tprfc.function_case_execute_result in and tprac.api_case_execute_result in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/> <include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when> </when>
<!-- 等级 -->
<when test="key == 'priority'"> <when test="key == 'priority'">
and tprac.api_case_priority in and tprac.api_case_priority in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/> <include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>

View File

@ -2,16 +2,16 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.plan.mapper.ExtTestPlanReportApiScenarioMapper"> <mapper namespace="io.metersphere.plan.mapper.ExtTestPlanReportApiScenarioMapper">
<select id="countExecuteResult" resultType="io.metersphere.plan.dto.CaseStatusCountMap"> <select id="countExecuteResult" resultType="io.metersphere.plan.dto.CaseStatusCountMap">
select tpras.api_scenario_execute_result as status, count(id) as count from test_plan_report_api_scenario tpras select ifnull(tpras.api_scenario_execute_result, 'PENDING') as status, count(id) as count from test_plan_report_api_scenario tpras
where tpras.test_plan_report_id = #{id} where tpras.test_plan_report_id = #{id}
group by tpras.api_scenario_execute_result group by tpras.api_scenario_execute_result
</select> </select>
<select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiScenario"> <select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiScenario">
select tpas.id as testPlanApiScenarioId, aso.id as apiScenarioId, aso.num as apiScenarioNum, aso.name as apiScenarioName, aso.priority as apiScenarioPriority, select tpas.id as testPlanApiScenarioId, aso.id as apiScenarioId, aso.num as apiScenarioNum, aso.name as apiScenarioName, aso.priority as apiScenarioPriority,
tpas.test_plan_collection_id testPlanCollectionId, tpas.grouped grouped, tpas.environment_id environmentId, tpas.test_plan_collection_id testPlanCollectionId, tpas.grouped as grouped, tpas.environment_id environmentId,
if(aso.module_id = 'root','未规划用例', aso.module_id) as apiScenarioModule, tpas.execute_user as apiScenarioExecuteUser, if(aso.module_id = 'root','未规划用例', aso.module_id) as apiScenarioModule, tpas.execute_user as apiScenarioExecuteUser,
ifnull(tpas.last_exec_result, 'PENDING') as apiScenarioExecuteResult, tpas.last_exec_report_id apiScenarioExecuteReportId, tpas.pos pos ifnull(tpas.last_exec_result, 'PENDING') as apiScenarioExecuteResult, tpas.last_exec_report_id apiScenarioExecuteReportId, tpas.pos as pos
from test_plan_api_scenario tpas join api_scenario aso on aso.id = tpas.api_scenario_id from test_plan_api_scenario tpas join api_scenario aso on aso.id = tpas.api_scenario_id
left join api_scenario_module asm on aso.module_id = asm.id left join api_scenario_module asm on aso.module_id = asm.id
where tpas.test_plan_id = #{id} and aso.deleted = false where tpas.test_plan_id = #{id} and aso.deleted = false
@ -24,10 +24,10 @@
</select> </select>
<select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO"> <select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO">
<!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数 --> <!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数、报告ID -->
select distinct tpras.api_scenario_id as id, tpras.api_scenario_num as num, tpras.api_scenario_name as name, select distinct tpras.api_scenario_id as id, tpras.api_scenario_num as num, tpras.api_scenario_name as name,
tpras.api_scenario_module as moduleName, tpras.api_scenario_priority as priority, tpras.api_scenario_execute_report_id reportId, tpras.api_scenario_module as moduleName, tpras.api_scenario_priority as priority, tpras.api_scenario_execute_report_id reportId,
tpras.api_scenario_execute_result as executeResult, tpras.api_scenario_execute_user as executeUser, 0 as bugCount ifnull(tpras.api_scenario_execute_result, 'PENDING') as executeResult, tpras.api_scenario_execute_user as executeUser, 0 as bugCount
from test_plan_report_api_scenario tpras from test_plan_report_api_scenario tpras
where tpras.test_plan_report_id = #{request.reportId} where tpras.test_plan_report_id = #{request.reportId}
<include refid="filter"/> <include refid="filter"/>
@ -38,11 +38,12 @@
<foreach collection="request.filter.entrySet()" index="key" item="values"> <foreach collection="request.filter.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0"> <if test="values != null and values.size() > 0">
<choose> <choose>
<!-- 执行状态 --> <!-- 执行结果 -->
<when test="key == 'executeResult'"> <when test="key == 'executeResult'">
and tpras.api_scenario_execute_result in and tpras.api_scenario_execute_result in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/> <include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when> </when>
<!-- 等级 -->
<when test="key == 'priority'"> <when test="key == 'priority'">
and tpras.api_scenario_priority in and tpras.api_scenario_priority in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/> <include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>

View File

@ -38,17 +38,17 @@
</select> </select>
<select id="countExecuteResult" resultType="io.metersphere.plan.dto.CaseStatusCountMap"> <select id="countExecuteResult" resultType="io.metersphere.plan.dto.CaseStatusCountMap">
select tprfc.function_case_execute_result as status, count(id) as count from test_plan_report_function_case tprfc select ifnull(tprfc.function_case_execute_result, 'PENDING') as status, count(id) as count from test_plan_report_function_case tprfc
where tprfc.test_plan_report_id = #{id} where tprfc.test_plan_report_id = #{id}
group by tprfc.function_case_execute_result group by tprfc.function_case_execute_result
</select> </select>
<select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO"> <select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO">
<!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数 --> <!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数、报告ID -->
select distinct tprfc.function_case_id as id, tprfc.function_case_num as num, tprfc.function_case_name as name, select tprfc.function_case_id as id, tprfc.function_case_num as num, tprfc.function_case_name as name,
tprfc.function_case_module as moduleName, tprfc.function_case_priority as priority, tprfc.function_case_module as moduleName, tprfc.function_case_priority as priority,
tprfc.function_case_execute_result as executeResult, tprfc.function_case_execute_user as executeUser, ifnull(tprfc.function_case_execute_result, 'PENDING') as executeResult, tprfc.function_case_execute_user as executeUser,
ifnull(tprfc.function_case_bug_count, 0) as bugCount, tprfc.function_case_execute_report_id reportId ifnull(tprfc.function_case_bug_count, 0) as bugCount, tprfc.function_case_execute_report_id reportId
from test_plan_report_function_case tprfc from test_plan_report_function_case tprfc
where tprfc.test_plan_report_id = #{request.reportId} where tprfc.test_plan_report_id = #{request.reportId}
<include refid="filter"/> <include refid="filter"/>
@ -64,11 +64,12 @@
<foreach collection="request.filter.entrySet()" index="key" item="values"> <foreach collection="request.filter.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0"> <if test="values != null and values.size() > 0">
<choose> <choose>
<!-- 执行状态 --> <!-- 执行结果 -->
<when test="key == 'executeResult'"> <when test="key == 'executeResult'">
and tprfc.function_case_execute_result in and tprfc.function_case_execute_result in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/> <include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>
</when> </when>
<!-- 等级 -->
<when test="key == 'priority'"> <when test="key == 'priority'">
and tprfc.function_case_priority in and tprfc.function_case_priority in
<include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/> <include refid="io.metersphere.system.mapper.BaseMapper.filterInWrapper"/>