refactor(测试跟踪): 关联场景用例支持全选
This commit is contained in:
parent
c9b399172f
commit
c2ce23fcac
|
@ -1032,20 +1032,27 @@ public class ApiAutomationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void relevance(ApiCaseRelevanceRequest request) {
|
public void relevance(ApiCaseRelevanceRequest request) {
|
||||||
|
buildApiCaseRelevanceRequest(request);
|
||||||
|
|
||||||
Map<String, List<String>> mapping = request.getMapping();
|
Map<String, List<String>> mapping = request.getMapping();
|
||||||
Map<String, String> envMap = request.getEnvMap();
|
Map<String, String> envMap = request.getEnvMap();
|
||||||
Set<String> set = mapping.keySet();
|
Set<String> set = mapping.keySet();
|
||||||
List<String> relevanceIds = request.getSelectIds();
|
List<String> relevanceIds = request.getIds();
|
||||||
Collections.reverse(relevanceIds);
|
Collections.reverse(relevanceIds);
|
||||||
String envType = request.getEnvironmentType();
|
String envType = request.getEnvironmentType();
|
||||||
String envGroupId = request.getEnvGroupId();
|
String envGroupId = request.getEnvGroupId();
|
||||||
if (set.isEmpty()) {
|
if (set.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Long nextOrder = ServiceUtils.getNextOrder(request.getPlanId(), extTestPlanScenarioCaseMapper::getLastOrder);
|
Long nextOrder = ServiceUtils.getNextOrder(request.getPlanId(), extTestPlanScenarioCaseMapper::getLastOrder);
|
||||||
for (String id : relevanceIds) {
|
for (String id : relevanceIds) {
|
||||||
Map<String, String> newEnvMap = new HashMap<>(16);
|
Map<String, String> newEnvMap = new HashMap<>(16);
|
||||||
List<String> list = mapping.get(id);
|
List<String> list = mapping.get(id);
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
ScenarioEnv scenarioEnv = getApiScenarioProjectId(id);
|
||||||
|
list = new ArrayList<>(scenarioEnv.getProjectIds());
|
||||||
|
}
|
||||||
list.forEach(l -> newEnvMap.put(l, envMap == null ? "" : envMap.getOrDefault(l, "")));
|
list.forEach(l -> newEnvMap.put(l, envMap == null ? "" : envMap.getOrDefault(l, "")));
|
||||||
TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario();
|
TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario();
|
||||||
testPlanApiScenario.setId(UUID.randomUUID().toString());
|
testPlanApiScenario.setId(UUID.randomUUID().toString());
|
||||||
|
@ -1070,6 +1077,12 @@ public class ApiAutomationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildApiCaseRelevanceRequest(ApiCaseRelevanceRequest request) {
|
||||||
|
this.initRequest(request.getCondition(), true, true);
|
||||||
|
ServiceUtils.getSelectAllIds(request, request.getCondition(),
|
||||||
|
(query) -> extApiScenarioMapper.selectRelevanceIdsByQuery(query));
|
||||||
|
}
|
||||||
|
|
||||||
public void relevanceReview(ApiCaseRelevanceRequest request) {
|
public void relevanceReview(ApiCaseRelevanceRequest request) {
|
||||||
Map<String, List<String>> mapping = request.getMapping();
|
Map<String, List<String>> mapping = request.getMapping();
|
||||||
Map<String, String> envMap = request.getEnvMap();
|
Map<String, String> envMap = request.getEnvMap();
|
||||||
|
@ -2257,7 +2270,7 @@ public class ApiAutomationService {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Compare the basic information of the APIScenario.
|
//Compare the basic information of the APIScenario.
|
||||||
|
|
||||||
if (!StringUtils.equals(exScenario.getName(), scenario.getName())) {
|
if (!StringUtils.equals(exScenario.getName(), scenario.getName())) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -94,4 +94,5 @@ public interface ExtApiScenarioMapper {
|
||||||
List<ApiScenarioWithBLOBs> selectRepeatByBLOBs(@Param("names") List<String> names, @Param("projectId") String projectId);
|
List<ApiScenarioWithBLOBs> selectRepeatByBLOBs(@Param("names") List<String> names, @Param("projectId") String projectId);
|
||||||
|
|
||||||
|
|
||||||
|
List<String> selectRelevanceIdsByQuery(@Param("request") BaseQueryRequest query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -763,6 +763,11 @@
|
||||||
and status != 'Trash'
|
and status != 'Trash'
|
||||||
and project_id = #{projectId}
|
and project_id = #{projectId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectRelevanceIdsByQuery" resultType="java.lang.String">
|
||||||
|
select api_scenario.id
|
||||||
|
from api_scenario
|
||||||
|
<include refid="queryWhereCondition"/>
|
||||||
|
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.track.request.testcase;
|
package io.metersphere.track.request.testcase;
|
||||||
|
|
||||||
|
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@ -27,6 +28,8 @@ public class ApiCaseRelevanceRequest {
|
||||||
*/
|
*/
|
||||||
private List<String> selectIds = new ArrayList<>();
|
private List<String> selectIds = new ArrayList<>();
|
||||||
|
|
||||||
|
private List<String> ids = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目环境对应关系
|
* 项目环境对应关系
|
||||||
*/
|
*/
|
||||||
|
@ -43,4 +46,6 @@ public class ApiCaseRelevanceRequest {
|
||||||
|
|
||||||
private String environmentType;
|
private String environmentType;
|
||||||
private String envGroupId;
|
private String envGroupId;
|
||||||
|
|
||||||
|
private ApiScenarioRequest condition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
@order="search"
|
@order="search"
|
||||||
@filter="filterSearch"
|
@filter="filterSearch"
|
||||||
:disable-header-config="true"
|
:disable-header-config="true"
|
||||||
:show-select-all="false"
|
:show-select-all="true"
|
||||||
@selectCountChange="selectCountChange">
|
@selectCountChange="selectCountChange">
|
||||||
|
|
||||||
<el-table-column v-if="!customNum" prop="num" label="ID" sortable="custom"
|
<el-table-column v-if="!customNum" prop="num" label="ID" sortable="custom"
|
||||||
|
|
|
@ -75,9 +75,6 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
planId() {
|
planId() {
|
||||||
this.condition.planId = this.planId;
|
this.condition.planId = this.planId;
|
||||||
},
|
|
||||||
projectId() {
|
|
||||||
this.getVersionOptions();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -164,7 +161,8 @@ export default {
|
||||||
param.envMap = strMapToObj(envMap);
|
param.envMap = strMapToObj(envMap);
|
||||||
param.environmentType = envType;
|
param.environmentType = envType;
|
||||||
param.envGroupId = envGroupId;
|
param.envGroupId = envGroupId;
|
||||||
param.selectIds = selectIds;
|
param.ids = selectIds;
|
||||||
|
param.condition = this.$refs.apiScenarioList.condition;
|
||||||
|
|
||||||
this.result = this.$post(url, param, () => {
|
this.result = this.$post(url, param, () => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
|
Loading…
Reference in New Issue