fix(测试跟踪): 修复测试计划运行检查是否有可用行用例的缺陷 (#16498)

Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
MeterSphere Bot 2022-07-29 17:56:53 +08:00 committed by GitHub
parent 18f6f0c480
commit 4afde03346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 51 additions and 21 deletions

View File

@ -21,7 +21,7 @@ public interface ExtTestPlanApiCaseMapper {
List<String> getIdsByPlanId(String planId);
List<String> getNotRelevanceCaseIds(@Param("planId")String planId, @Param("relevanceProjectIds")List<String> relevanceProjectIds);
List<String> getNotRelevanceCaseIds(@Param("planId") String planId, @Param("relevanceProjectIds") List<String> relevanceProjectIds);
List<String> getStatusByTestPlanId(String id);
@ -37,17 +37,18 @@ public interface ExtTestPlanApiCaseMapper {
List<TestPlanFailureApiDTO> getFailureList(@Param("planId") String planId, @Param("status") String status);
List<TestPlanFailureApiDTO> getFailureListByIds(@Param("ids") Collection<String> caseIdList,@Param("status") String status);
List<TestPlanFailureApiDTO> getFailureListByIds(@Param("ids") Collection<String> caseIdList, @Param("status") String status);
List<String> selectPlanIds();
List<String> getIdsOrderByUpdateTime(@Param("planId") String planId);
Long getPreOrder(@Param("planId")String planId, @Param("baseOrder") Long baseOrder);
Long getPreOrder(@Param("planId") String planId, @Param("baseOrder") Long baseOrder);
Long getLastOrder(@Param("planId")String planId, @Param("baseOrder") Long baseOrder);
Long getLastOrder(@Param("planId") String planId, @Param("baseOrder") Long baseOrder);
List<TestPlanApiCase> selectByIdsAndStatusIsNotTrash(@Param("ids") List<String> ids);
List<TestPlanApiCase> selectPlanByIdsAndStatusIsNotTrash(@Param("ids") List<String> ids);
}

View File

@ -388,14 +388,27 @@
<select id="selectByIdsAndStatusIsNotTrash" resultType="io.metersphere.base.domain.TestPlanApiCase">
SELECT
plan.*
plan.*
FROM
test_plan_api_case plan
INNER JOIN api_test_case api ON plan.api_case_id = api.id
test_plan_api_case plan
INNER JOIN api_test_case api ON plan.api_case_id = api.id
WHERE
(api.`status` is null OR api.`status` != 'Trash') AND plan.id IN
(api.`status` is null OR api.`status` != 'Trash') AND plan.id IN
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</select>
<select id="selectPlanByIdsAndStatusIsNotTrash" resultType="io.metersphere.base.domain.TestPlanApiCase">
SELECT
plan.*
FROM
test_plan_api_case plan
INNER JOIN api_test_case api ON plan.api_case_id = api.id
WHERE
(api.`status` is null OR api.`status` != 'Trash') AND plan.test_plan_id IN
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</select>
</mapper>

View File

@ -7,4 +7,7 @@ import java.util.List;
public interface ExtTestPlanApiScenarioMapper {
public List<TestPlanApiScenario> selectByIdsAndStatusIsNotTrash(@Param("ids") List<String> ids);
List<TestPlanApiScenario> selectPlanByIdsAndStatusIsNotTrash(@Param("ids") List<String> ids);
}

View File

@ -3,14 +3,27 @@
<mapper namespace="io.metersphere.base.mapper.ext.ExtTestPlanApiScenarioMapper">
<select id="selectByIdsAndStatusIsNotTrash" resultType="io.metersphere.base.domain.TestPlanApiScenario">
SELECT
plan.*
plan.*
FROM
test_plan_api_scenario plan
INNER JOIN api_scenario api ON plan.api_scenario_id = api.id
test_plan_api_scenario plan
INNER JOIN api_scenario api ON plan.api_scenario_id = api.id
WHERE
(api.`status` is null OR api.`status` != 'Trash') AND plan.id IN
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
(api.`status` is null OR api.`status` != 'Trash') AND plan.id IN
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</select>
<select id="selectPlanByIdsAndStatusIsNotTrash"
resultType="io.metersphere.base.domain.TestPlanApiScenario">
SELECT
plan.*
FROM
test_plan_api_scenario plan
INNER JOIN api_scenario api ON plan.api_scenario_id = api.id
WHERE
(api.`status` is null OR api.`status` != 'Trash') AND plan.test_plan_id IN
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</select>
</mapper>

View File

@ -7,7 +7,7 @@ import java.util.List;
public interface ExtTestPlanUiScenarioMapper {
List<TestPlanUiScenario> selectByIdsAndStatusIsNotTrash(@Param("ids") List<String> ids);
List<TestPlanUiScenario> selectPlanByIdsAndStatusIsNotTrash(@Param("ids") List<String> ids);
}

View File

@ -3,14 +3,14 @@
<mapper namespace="io.metersphere.base.mapper.ext.ExtTestPlanUiScenarioMapper">
<select id="selectByIdsAndStatusIsNotTrash" resultType="io.metersphere.base.domain.TestPlanUiScenario">
<select id="selectPlanByIdsAndStatusIsNotTrash" resultType="io.metersphere.base.domain.TestPlanUiScenario">
SELECT
plan.*
FROM
test_plan_ui_scenario plan
INNER JOIN ui_scenario ui ON plan.ui_scenario_id = ui.id
WHERE
(ui.`status` is null OR ui.`status` != 'Trash') AND plan.id IN
(ui.`status` is null OR ui.`status` != 'Trash') AND plan.test_plan_id IN
<foreach collection="ids" item="v" separator="," open="(" close=")">
#{v}
</foreach>

View File

@ -2148,12 +2148,12 @@ public class TestPlanService {
}
List<String> ids = new ArrayList<>();
ids.add(id);
List<TestPlanApiCase> testPlanApiCases = extTestPlanApiCaseMapper.selectByIdsAndStatusIsNotTrash(ids);
List<TestPlanApiCase> testPlanApiCases = extTestPlanApiCaseMapper.selectPlanByIdsAndStatusIsNotTrash(ids);
if (!CollectionUtils.isEmpty(testPlanApiCases)) {
return true;
}
List<TestPlanApiScenario> testPlanApiScenarios = extTestPlanApiScenarioMapper.selectByIdsAndStatusIsNotTrash(ids);
List<TestPlanApiScenario> testPlanApiScenarios = extTestPlanApiScenarioMapper.selectPlanByIdsAndStatusIsNotTrash(ids);
if (!CollectionUtils.isEmpty(testPlanApiScenarios)) {
return true;
}
@ -2407,7 +2407,7 @@ public class TestPlanService {
List<String> ids = new ArrayList<>();
ids.add(id);
List<TestPlanUiScenario> testPlanUiScenarios = extTestPlanUiScenarioMapper.selectByIdsAndStatusIsNotTrash(ids);
List<TestPlanUiScenario> testPlanUiScenarios = extTestPlanUiScenarioMapper.selectPlanByIdsAndStatusIsNotTrash(ids);
return !CollectionUtils.isEmpty(testPlanUiScenarios);
}
}