feat(测试计划): 资源关联增加归属测试计划选项
This commit is contained in:
parent
b4046ad7d5
commit
01bd11b858
|
@ -442,6 +442,15 @@
|
||||||
<property name="column" value="api_definition.path"/>
|
<property name="column" value="api_definition.path"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="condition.name == 'belongTestPlan' and condition.operator == 'EQUALS'">
|
||||||
|
api_definition.id in (
|
||||||
|
select api.id from api_definition api inner join api_test_case apiCase ON api.id =
|
||||||
|
apiCase.api_definition_id
|
||||||
|
WHERE api.deleted IS FALSE and apiCase.deleted IS FALSE and apiCase.id in (
|
||||||
|
select api_case_id from test_plan_api_case where test_plan_id = #{condition.value}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<if test="condition.name == 'caseTotal'">
|
<if test="condition.name == 'caseTotal'">
|
||||||
<choose>
|
<choose>
|
||||||
<when test="condition.operator == 'NOT_EMPTY'">
|
<when test="condition.operator == 'NOT_EMPTY'">
|
||||||
|
|
|
@ -325,6 +325,12 @@
|
||||||
<property name="condition" value="condition"/>
|
<property name="condition" value="condition"/>
|
||||||
<property name="tablePrefix" value="api_scenario"/>
|
<property name="tablePrefix" value="api_scenario"/>
|
||||||
</include>
|
</include>
|
||||||
|
<if test="condition.name == 'belongTestPlan' and condition.operator == 'EQUALS'">
|
||||||
|
api_scenario.id in (
|
||||||
|
select test_plan_api_scenario.api_scenario_id from test_plan_api_scenario where
|
||||||
|
test_plan_api_scenario.test_plan_id = #{condition.value}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<!-- 场景等级 -->
|
<!-- 场景等级 -->
|
||||||
<if test="condition.name == 'priority'">
|
<if test="condition.name == 'priority'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
|
|
@ -608,6 +608,12 @@
|
||||||
<property name="condition" value="condition"/>
|
<property name="condition" value="condition"/>
|
||||||
<property name="tablePrefix" value="atc"/>
|
<property name="tablePrefix" value="atc"/>
|
||||||
</include>
|
</include>
|
||||||
|
<if test="condition.name == 'belongTestPlan' and condition.operator == 'EQUALS'">
|
||||||
|
atc.id in (
|
||||||
|
select test_plan_api_case.api_case_id from test_plan_api_case where
|
||||||
|
test_plan_api_case.test_plan_id = #{condition.value}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<!-- 模块ID -->
|
<!-- 模块ID -->
|
||||||
<if test="condition.name == 'moduleId'">
|
<if test="condition.name == 'moduleId'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
|
|
|
@ -353,6 +353,12 @@
|
||||||
<property name="condition" value="condition"/>
|
<property name="condition" value="condition"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="condition.name == 'belongTestPlan' and condition.operator == 'EQUALS'">
|
||||||
|
functional_case.id in (
|
||||||
|
select functional_case_id from test_plan_functional_case where test_plan_id
|
||||||
|
= #{condition.value}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<!-- 关联附件 -->
|
<!-- 关联附件 -->
|
||||||
<if test="condition.name == 'attachment'">
|
<if test="condition.name == 'attachment'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.associationCondition">
|
||||||
|
|
|
@ -411,6 +411,15 @@
|
||||||
<property name="column" value="a.protocol"/>
|
<property name="column" value="a.protocol"/>
|
||||||
</include>
|
</include>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="condition.name == 'belongTestPlan' and condition.operator == 'EQUALS'">
|
||||||
|
a.id in (
|
||||||
|
select api.id from api_definition api inner join api_test_case apiCase ON api.id =
|
||||||
|
apiCase.api_definition_id
|
||||||
|
WHERE api.deleted IS FALSE and apiCase.deleted IS FALSE and apiCase.id in (
|
||||||
|
select api_case_id from test_plan_api_case where test_plan_id = #{condition.value}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<if test="condition.name == 'status'">
|
<if test="condition.name == 'status'">
|
||||||
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
<property name="condition" value="condition"/>
|
<property name="condition" value="condition"/>
|
||||||
|
@ -505,6 +514,11 @@
|
||||||
<property name="condition" value="condition"/>
|
<property name="condition" value="condition"/>
|
||||||
<property name="tablePrefix" value="atc"/>
|
<property name="tablePrefix" value="atc"/>
|
||||||
</include>
|
</include>
|
||||||
|
<if test="condition.name == 'belongTestPlan' and condition.operator == 'EQUALS'">
|
||||||
|
atc.id in (
|
||||||
|
select api_case_id from test_plan_api_case where test_plan_id = #{condition.value}
|
||||||
|
)
|
||||||
|
</if>
|
||||||
<!-- 所属模块(项目ID_模块ID 组合查询) -->
|
<!-- 所属模块(项目ID_模块ID 组合查询) -->
|
||||||
<if test="condition.name == 'moduleId'">
|
<if test="condition.name == 'moduleId'">
|
||||||
<choose>
|
<choose>
|
||||||
|
|
|
@ -5,6 +5,8 @@ import io.metersphere.functional.request.FunctionalCasePageRequest;
|
||||||
import io.metersphere.plan.dto.request.TestPlanApiCaseRequest;
|
import io.metersphere.plan.dto.request.TestPlanApiCaseRequest;
|
||||||
import io.metersphere.plan.dto.request.TestPlanApiRequest;
|
import io.metersphere.plan.dto.request.TestPlanApiRequest;
|
||||||
import io.metersphere.plan.dto.request.TestPlanApiScenarioRequest;
|
import io.metersphere.plan.dto.request.TestPlanApiScenarioRequest;
|
||||||
|
import io.metersphere.sdk.dto.CombineCondition;
|
||||||
|
import io.metersphere.sdk.dto.CombineSearch;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.system.base.BaseTest;
|
import io.metersphere.system.base.BaseTest;
|
||||||
import io.metersphere.system.controller.handler.ResultHolder;
|
import io.metersphere.system.controller.handler.ResultHolder;
|
||||||
|
@ -16,6 +18,7 @@ import org.springframework.test.context.jdbc.SqlConfig;
|
||||||
import org.springframework.test.web.servlet.MvcResult;
|
import org.springframework.test.web.servlet.MvcResult;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -49,6 +52,20 @@ public class TestPlanAssociateControllerTests extends BaseTest {
|
||||||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
Assertions.assertNotNull(resultHolder);
|
Assertions.assertNotNull(resultHolder);
|
||||||
|
|
||||||
|
|
||||||
|
request.setCombineSearch(
|
||||||
|
new CombineSearch() {{
|
||||||
|
this.setConditions(Collections.singletonList(new CombineCondition() {{
|
||||||
|
this.setName("belongTestPlan");
|
||||||
|
this.setOperator(CombineConditionOperator.EQUALS.name());
|
||||||
|
this.setValue("testABCD");
|
||||||
|
}}));
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
mvcResult = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_ASSOCIATION_URL, request);
|
||||||
|
returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
|
Assertions.assertNotNull(resultHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -71,6 +88,20 @@ public class TestPlanAssociateControllerTests extends BaseTest {
|
||||||
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
Assertions.assertNotNull(resultHolder);
|
Assertions.assertNotNull(resultHolder);
|
||||||
|
|
||||||
|
request.setCombineSearch(
|
||||||
|
new CombineSearch() {{
|
||||||
|
this.setConditions(Collections.singletonList(new CombineCondition() {{
|
||||||
|
this.setName("belongTestPlan");
|
||||||
|
this.setOperator(CombineConditionOperator.EQUALS.name());
|
||||||
|
this.setValue("testABCD");
|
||||||
|
}}));
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
mvcResult = this.requestPostWithOkAndReturn(API_ASSOCIATION_URL, request);
|
||||||
|
returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
|
Assertions.assertNotNull(resultHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -94,6 +125,20 @@ public class TestPlanAssociateControllerTests extends BaseTest {
|
||||||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
Assertions.assertNotNull(resultHolder);
|
Assertions.assertNotNull(resultHolder);
|
||||||
|
|
||||||
|
|
||||||
|
request.setCombineSearch(
|
||||||
|
new CombineSearch() {{
|
||||||
|
this.setConditions(Collections.singletonList(new CombineCondition() {{
|
||||||
|
this.setName("belongTestPlan");
|
||||||
|
this.setOperator(CombineConditionOperator.EQUALS.name());
|
||||||
|
this.setValue("testABCD");
|
||||||
|
}}));
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
mvcResult = this.requestPostWithOkAndReturn(API_CASE_ASSOCIATION_URL, request);
|
||||||
|
returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
|
Assertions.assertNotNull(resultHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -115,6 +160,19 @@ public class TestPlanAssociateControllerTests extends BaseTest {
|
||||||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
Assertions.assertNotNull(resultHolder);
|
Assertions.assertNotNull(resultHolder);
|
||||||
|
|
||||||
|
request.setCombineSearch(
|
||||||
|
new CombineSearch() {{
|
||||||
|
this.setConditions(Collections.singletonList(new CombineCondition() {{
|
||||||
|
this.setName("belongTestPlan");
|
||||||
|
this.setOperator(CombineConditionOperator.EQUALS.name());
|
||||||
|
this.setValue("testABCD");
|
||||||
|
}}));
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
mvcResult = this.requestPostWithOkAndReturn(API_SCENARIO_URL, request);
|
||||||
|
returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
|
resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
|
Assertions.assertNotNull(resultHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -130,6 +188,7 @@ public class TestPlanAssociateControllerTests extends BaseTest {
|
||||||
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||||
Assertions.assertNotNull(resultHolder);
|
Assertions.assertNotNull(resultHolder);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue