parent
bed0ed6faf
commit
e4d1cfa9a2
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.parser.Feature;
|
import com.alibaba.fastjson.parser.Feature;
|
||||||
import io.metersphere.api.dto.EnvironmentType;
|
import io.metersphere.api.dto.EnvironmentType;
|
||||||
|
import io.metersphere.api.dto.RunModeConfigWithEnvironmentDTO;
|
||||||
import io.metersphere.api.dto.ScenarioEnv;
|
import io.metersphere.api.dto.ScenarioEnv;
|
||||||
import io.metersphere.api.dto.automation.ApiScenarioDTO;
|
import io.metersphere.api.dto.automation.ApiScenarioDTO;
|
||||||
import io.metersphere.api.dto.automation.RunScenarioRequest;
|
import io.metersphere.api.dto.automation.RunScenarioRequest;
|
||||||
|
@ -22,6 +23,7 @@ import io.metersphere.commons.constants.MsTestElementConstants;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
|
import io.metersphere.dto.RunModeConfigDTO;
|
||||||
import io.metersphere.plugin.core.MsTestElement;
|
import io.metersphere.plugin.core.MsTestElement;
|
||||||
import io.metersphere.service.EnvironmentGroupProjectService;
|
import io.metersphere.service.EnvironmentGroupProjectService;
|
||||||
import io.metersphere.service.ProjectService;
|
import io.metersphere.service.ProjectService;
|
||||||
|
@ -471,4 +473,74 @@ public class ApiScenarioEnvService {
|
||||||
}
|
}
|
||||||
return returnMap;
|
return returnMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, List<String>> selectProjectEnvMapByTestPlanScenarioIds(List<String> resourceIds) {
|
||||||
|
Map<String, List<String>> returnMap = new LinkedHashMap<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(resourceIds)) {
|
||||||
|
List<String> reportEnvConfList = testPlanApiScenarioMapper.selectReportEnvConfByResourceIds(resourceIds);
|
||||||
|
reportEnvConfList.forEach(envConf -> {
|
||||||
|
LinkedHashMap<String, List<String>> projectEnvMap = this.getProjectEnvMapByEnvConfig(envConf);
|
||||||
|
for (Map.Entry<String, List<String>> entry : projectEnvMap.entrySet()) {
|
||||||
|
String projectName = entry.getKey();
|
||||||
|
List<String> envNameList = entry.getValue();
|
||||||
|
if (StringUtils.isEmpty(projectName) || CollectionUtils.isEmpty(envNameList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (returnMap.containsKey(projectName)) {
|
||||||
|
envNameList.forEach(envName -> {
|
||||||
|
if (!returnMap.get(projectName).contains(envName)) {
|
||||||
|
returnMap.get(projectName).add(envName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
returnMap.put(projectName, envNameList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return returnMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinkedHashMap<String, List<String>> getProjectEnvMapByEnvConfig(String envConfig) {
|
||||||
|
LinkedHashMap<String, List<String>> returnMap = new LinkedHashMap<>();
|
||||||
|
//运行设置中选择的环境信息(批量执行时在前台选择了执行信息)
|
||||||
|
Map<String, String> envMapByRunConfig = null;
|
||||||
|
//执行时选择的环境信息 (一般在集合报告中会记录)
|
||||||
|
Map<String, List<String>> envMapByExecution = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(envConfig);
|
||||||
|
if (jsonObject.containsKey("executionEnvironmentMap")) {
|
||||||
|
RunModeConfigWithEnvironmentDTO configWithEnvironment = JSONObject.parseObject(envConfig, RunModeConfigWithEnvironmentDTO.class);
|
||||||
|
if (MapUtils.isNotEmpty(configWithEnvironment.getExecutionEnvironmentMap())) {
|
||||||
|
envMapByExecution = configWithEnvironment.getExecutionEnvironmentMap();
|
||||||
|
} else {
|
||||||
|
envMapByRunConfig = configWithEnvironment.getEnvMap();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
RunModeConfigDTO config = JSONObject.parseObject(envConfig, RunModeConfigDTO.class);
|
||||||
|
envMapByRunConfig = config.getEnvMap();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error("解析RunModeConfig失败!参数:" + envConfig, e);
|
||||||
|
}
|
||||||
|
returnMap.putAll(this.selectProjectNameAndEnvName(envMapByExecution));
|
||||||
|
|
||||||
|
if (MapUtils.isNotEmpty(envMapByRunConfig)) {
|
||||||
|
for (Map.Entry<String, String> entry : envMapByRunConfig.entrySet()) {
|
||||||
|
String projectId = entry.getKey();
|
||||||
|
String envId = entry.getValue();
|
||||||
|
String projectName = projectService.selectNameById(projectId);
|
||||||
|
String envName = apiTestEnvironmentService.selectNameById(envId);
|
||||||
|
if (StringUtils.isNoneEmpty(projectName, envName)) {
|
||||||
|
returnMap.put(projectName, new ArrayList<>() {{
|
||||||
|
this.add(envName);
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -523,4 +523,12 @@ public class ApiDefinitionExecResultService {
|
||||||
});
|
});
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ApiDefinitionExecResultWithBLOBs> selectByResourceIdsAndMaxCreateTime(List<String> resourceIds) {
|
||||||
|
if (CollectionUtils.isNotEmpty(resourceIds)) {
|
||||||
|
return extApiDefinitionExecResultMapper.selectByResourceIdsAndMaxCreateTime(resourceIds);
|
||||||
|
} else {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,9 @@ public class ApiDefinitionService {
|
||||||
private ApiModuleService apiModuleService;
|
private ApiModuleService apiModuleService;
|
||||||
@Resource
|
@Resource
|
||||||
private ApiTestEnvironmentService apiTestEnvironmentService;
|
private ApiTestEnvironmentService apiTestEnvironmentService;
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private ProjectService projectService;
|
||||||
|
|
||||||
private ThreadLocal<Long> currentApiOrder = new ThreadLocal<>();
|
private ThreadLocal<Long> currentApiOrder = new ThreadLocal<>();
|
||||||
private ThreadLocal<Long> currentApiCaseOrder = new ThreadLocal<>();
|
private ThreadLocal<Long> currentApiCaseOrder = new ThreadLocal<>();
|
||||||
|
@ -1344,6 +1347,27 @@ public class ApiDefinitionService {
|
||||||
return reportResult;
|
return reportResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, List<String>> getProjectEnvNameByEnvConfig(String projectId, String envConfig) {
|
||||||
|
Map<String, List<String>> returnMap = new HashMap<>();
|
||||||
|
RunModeConfigDTO runModeConfigDTO = null;
|
||||||
|
try {
|
||||||
|
runModeConfigDTO = JSONObject.parseObject(envConfig, RunModeConfigDTO.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error("解析" + envConfig + "为RunModeConfigDTO时失败!", e);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(projectId) && runModeConfigDTO != null && MapUtils.isNotEmpty(runModeConfigDTO.getEnvMap())) {
|
||||||
|
String envId = runModeConfigDTO.getEnvMap().get(projectId);
|
||||||
|
String envName = apiTestEnvironmentService.selectNameById(envId);
|
||||||
|
String projectName = projectService.selectNameById(projectId);
|
||||||
|
if (StringUtils.isNoneEmpty(envName, projectName)) {
|
||||||
|
returnMap.put(projectName, new ArrayList<>() {{
|
||||||
|
this.add(envName);
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnMap;
|
||||||
|
}
|
||||||
|
|
||||||
public String getEnvNameByEnvConfig(String projectId, String envConfig) {
|
public String getEnvNameByEnvConfig(String projectId, String envConfig) {
|
||||||
String envName = null;
|
String envName = null;
|
||||||
RunModeConfigDTO runModeConfigDTO = null;
|
RunModeConfigDTO runModeConfigDTO = null;
|
||||||
|
|
|
@ -4,7 +4,10 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.parser.Feature;
|
import com.alibaba.fastjson.parser.Feature;
|
||||||
import io.metersphere.api.dto.*;
|
import io.metersphere.api.dto.ApiScenarioReportBaseInfoDTO;
|
||||||
|
import io.metersphere.api.dto.ApiScenarioReportDTO;
|
||||||
|
import io.metersphere.api.dto.RequestResultExpandDTO;
|
||||||
|
import io.metersphere.api.dto.StepTreeDTO;
|
||||||
import io.metersphere.api.exec.scenario.ApiScenarioEnvService;
|
import io.metersphere.api.exec.scenario.ApiScenarioEnvService;
|
||||||
import io.metersphere.api.exec.utils.ResultParseUtil;
|
import io.metersphere.api.exec.utils.ResultParseUtil;
|
||||||
import io.metersphere.api.service.vo.ApiDefinitionExecResultVo;
|
import io.metersphere.api.service.vo.ApiDefinitionExecResultVo;
|
||||||
|
@ -20,7 +23,6 @@ import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.constants.RunModeConstants;
|
import io.metersphere.constants.RunModeConstants;
|
||||||
import io.metersphere.dto.RequestResult;
|
import io.metersphere.dto.RequestResult;
|
||||||
import io.metersphere.dto.RunModeConfigDTO;
|
|
||||||
import io.metersphere.service.ProjectService;
|
import io.metersphere.service.ProjectService;
|
||||||
import io.metersphere.utils.LoggerUtil;
|
import io.metersphere.utils.LoggerUtil;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -398,8 +400,8 @@ public class ApiScenarioReportStructureService {
|
||||||
}
|
}
|
||||||
// 非正常执行结束的请求结果
|
// 非正常执行结束的请求结果
|
||||||
List<StepTreeDTO> unList = dtoList.stream().filter(e -> e.getValue() != null
|
List<StepTreeDTO> unList = dtoList.stream().filter(e -> e.getValue() != null
|
||||||
&& ((StringUtils.equalsIgnoreCase(e.getType(), "DubboSampler") && e.getValue().getStartTime() == 0)
|
&& ((StringUtils.equalsIgnoreCase(e.getType(), "DubboSampler") && e.getValue().getStartTime() == 0)
|
||||||
|| StringUtils.equalsIgnoreCase(e.getTotalStatus(), ExecuteResult.UN_EXECUTE.toString())))
|
|| StringUtils.equalsIgnoreCase(e.getTotalStatus(), ExecuteResult.UN_EXECUTE.toString())))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// 有效数据按照时间排序
|
// 有效数据按照时间排序
|
||||||
|
@ -545,45 +547,9 @@ public class ApiScenarioReportStructureService {
|
||||||
|
|
||||||
public void initProjectEnvironmentByEnvConfig(ApiScenarioReportDTO dto, String envConfig) {
|
public void initProjectEnvironmentByEnvConfig(ApiScenarioReportDTO dto, String envConfig) {
|
||||||
if (StringUtils.isNotEmpty(envConfig)) {
|
if (StringUtils.isNotEmpty(envConfig)) {
|
||||||
//运行设置中选择的环境信息(批量执行时在前台选择了执行信息)
|
LinkedHashMap<String, List<String>> projectEnvMap = apiScenarioEnvService.getProjectEnvMapByEnvConfig(envConfig);
|
||||||
Map<String, String> envMapByRunConfig = null;
|
if (MapUtils.isNotEmpty(projectEnvMap)) {
|
||||||
//执行时选择的环境信息 (一般在集合报告中会记录)
|
dto.setProjectEnvMap(projectEnvMap);
|
||||||
Map<String, List<String>> envMapByExecution = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(envConfig);
|
|
||||||
if (jsonObject.containsKey("executionEnvironmentMap")) {
|
|
||||||
RunModeConfigWithEnvironmentDTO configWithEnvironment = JSONObject.parseObject(envConfig, RunModeConfigWithEnvironmentDTO.class);
|
|
||||||
if (MapUtils.isNotEmpty(configWithEnvironment.getExecutionEnvironmentMap())) {
|
|
||||||
envMapByExecution = configWithEnvironment.getExecutionEnvironmentMap();
|
|
||||||
} else {
|
|
||||||
envMapByRunConfig = configWithEnvironment.getEnvMap();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
RunModeConfigDTO config = JSONObject.parseObject(envConfig, RunModeConfigDTO.class);
|
|
||||||
envMapByRunConfig = config.getEnvMap();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogUtil.error("解析RunModeConfig失败!参数:" + envConfig, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
LinkedHashMap<String, List<String>> projectEnvMap = apiScenarioEnvService.selectProjectNameAndEnvName(envMapByExecution);
|
|
||||||
|
|
||||||
if (MapUtils.isNotEmpty(envMapByRunConfig)) {
|
|
||||||
for (Map.Entry<String, String> entry : envMapByRunConfig.entrySet()) {
|
|
||||||
String projectId = entry.getKey();
|
|
||||||
String envId = entry.getValue();
|
|
||||||
String projectName = projectService.selectNameById(projectId);
|
|
||||||
String envName = apiTestEnvironmentService.selectNameById(envId);
|
|
||||||
if (StringUtils.isNoneEmpty(projectName, envName)) {
|
|
||||||
projectEnvMap.put(projectName, new ArrayList<>() {{
|
|
||||||
this.add(envName);
|
|
||||||
}});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (MapUtils.isNotEmpty(projectEnvMap)) {
|
|
||||||
dto.setProjectEnvMap(projectEnvMap);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,10 @@ package io.metersphere.base.mapper;
|
||||||
|
|
||||||
import io.metersphere.base.domain.TestPlanApiScenario;
|
import io.metersphere.base.domain.TestPlanApiScenario;
|
||||||
import io.metersphere.base.domain.TestPlanApiScenarioExample;
|
import io.metersphere.base.domain.TestPlanApiScenarioExample;
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface TestPlanApiScenarioMapper {
|
public interface TestPlanApiScenarioMapper {
|
||||||
long countByExample(TestPlanApiScenarioExample example);
|
long countByExample(TestPlanApiScenarioExample example);
|
||||||
|
|
||||||
|
@ -33,4 +34,6 @@ public interface TestPlanApiScenarioMapper {
|
||||||
int updateByPrimaryKeyWithBLOBs(TestPlanApiScenario record);
|
int updateByPrimaryKeyWithBLOBs(TestPlanApiScenario record);
|
||||||
|
|
||||||
int updateByPrimaryKey(TestPlanApiScenario record);
|
int updateByPrimaryKey(TestPlanApiScenario record);
|
||||||
|
|
||||||
|
List<String> selectReportEnvConfByResourceIds(@Param("ids") List<String> resourceIds);
|
||||||
}
|
}
|
|
@ -1,411 +1,427 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!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.base.mapper.TestPlanApiScenarioMapper">
|
<mapper namespace="io.metersphere.base.mapper.TestPlanApiScenarioMapper">
|
||||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestPlanApiScenario">
|
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestPlanApiScenario">
|
||||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||||
<result column="test_plan_id" jdbcType="VARCHAR" property="testPlanId" />
|
<result column="test_plan_id" jdbcType="VARCHAR" property="testPlanId"/>
|
||||||
<result column="api_scenario_id" jdbcType="VARCHAR" property="apiScenarioId" />
|
<result column="api_scenario_id" jdbcType="VARCHAR" property="apiScenarioId"/>
|
||||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
<result column="status" jdbcType="VARCHAR" property="status"/>
|
||||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
|
||||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
|
||||||
<result column="pass_rate" jdbcType="VARCHAR" property="passRate" />
|
<result column="pass_rate" jdbcType="VARCHAR" property="passRate"/>
|
||||||
<result column="last_result" jdbcType="VARCHAR" property="lastResult" />
|
<result column="last_result" jdbcType="VARCHAR" property="lastResult"/>
|
||||||
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
|
<result column="report_id" jdbcType="VARCHAR" property="reportId"/>
|
||||||
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
<result column="create_user" jdbcType="VARCHAR" property="createUser"/>
|
||||||
<result column="order" jdbcType="BIGINT" property="order" />
|
<result column="order" jdbcType="BIGINT" property="order"/>
|
||||||
<result column="environment_type" jdbcType="VARCHAR" property="environmentType" />
|
<result column="environment_type" jdbcType="VARCHAR" property="environmentType"/>
|
||||||
<result column="environment_group_id" jdbcType="VARCHAR" property="environmentGroupId" />
|
<result column="environment_group_id" jdbcType="VARCHAR" property="environmentGroupId"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanApiScenario">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanApiScenario">
|
||||||
<result column="environment" jdbcType="LONGVARCHAR" property="environment" />
|
<result column="environment" jdbcType="LONGVARCHAR" property="environment"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Example_Where_Clause">
|
<sql id="Example_Where_Clause">
|
||||||
<where>
|
<where>
|
||||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||||
<if test="criteria.valid">
|
<if test="criteria.valid">
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
<choose>
|
<choose>
|
||||||
<when test="criterion.noValue">
|
<when test="criterion.noValue">
|
||||||
and ${criterion.condition}
|
and ${criterion.condition}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.singleValue">
|
<when test="criterion.singleValue">
|
||||||
and ${criterion.condition} #{criterion.value}
|
and ${criterion.condition} #{criterion.value}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.betweenValue">
|
<when test="criterion.betweenValue">
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.listValue">
|
<when test="criterion.listValue">
|
||||||
and ${criterion.condition}
|
and ${criterion.condition}
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
||||||
#{listItem}
|
separator=",">
|
||||||
</foreach>
|
#{listItem}
|
||||||
</when>
|
</foreach>
|
||||||
</choose>
|
</when>
|
||||||
|
</choose>
|
||||||
|
</foreach>
|
||||||
|
</trim>
|
||||||
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</trim>
|
</where>
|
||||||
</if>
|
</sql>
|
||||||
</foreach>
|
<sql id="Update_By_Example_Where_Clause">
|
||||||
</where>
|
<where>
|
||||||
</sql>
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||||
<sql id="Update_By_Example_Where_Clause">
|
<if test="criteria.valid">
|
||||||
<where>
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
<foreach collection="criteria.criteria" item="criterion">
|
||||||
<if test="criteria.valid">
|
<choose>
|
||||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
<when test="criterion.noValue">
|
||||||
<foreach collection="criteria.criteria" item="criterion">
|
and ${criterion.condition}
|
||||||
<choose>
|
</when>
|
||||||
<when test="criterion.noValue">
|
<when test="criterion.singleValue">
|
||||||
and ${criterion.condition}
|
and ${criterion.condition} #{criterion.value}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.singleValue">
|
<when test="criterion.betweenValue">
|
||||||
and ${criterion.condition} #{criterion.value}
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||||
</when>
|
</when>
|
||||||
<when test="criterion.betweenValue">
|
<when test="criterion.listValue">
|
||||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
and ${criterion.condition}
|
||||||
</when>
|
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
||||||
<when test="criterion.listValue">
|
separator=",">
|
||||||
and ${criterion.condition}
|
#{listItem}
|
||||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
</foreach>
|
||||||
#{listItem}
|
</when>
|
||||||
</foreach>
|
</choose>
|
||||||
</when>
|
</foreach>
|
||||||
</choose>
|
</trim>
|
||||||
|
</if>
|
||||||
</foreach>
|
</foreach>
|
||||||
</trim>
|
</where>
|
||||||
</if>
|
</sql>
|
||||||
</foreach>
|
<sql id="Base_Column_List">
|
||||||
</where>
|
id
|
||||||
</sql>
|
, test_plan_id, api_scenario_id, `status`, create_time, update_time, pass_rate,
|
||||||
<sql id="Base_Column_List">
|
|
||||||
id, test_plan_id, api_scenario_id, `status`, create_time, update_time, pass_rate,
|
|
||||||
last_result, report_id, create_user, `order`, environment_type, environment_group_id
|
last_result, report_id, create_user, `order`, environment_type, environment_group_id
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
environment
|
environment
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanApiScenarioExample" resultMap="ResultMapWithBLOBs">
|
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanApiScenarioExample"
|
||||||
select
|
resultMap="ResultMapWithBLOBs">
|
||||||
<if test="distinct">
|
select
|
||||||
distinct
|
<if test="distinct">
|
||||||
</if>
|
distinct
|
||||||
<include refid="Base_Column_List" />
|
</if>
|
||||||
,
|
<include refid="Base_Column_List"/>
|
||||||
<include refid="Blob_Column_List" />
|
,
|
||||||
from test_plan_api_scenario
|
<include refid="Blob_Column_List"/>
|
||||||
<if test="_parameter != null">
|
from test_plan_api_scenario
|
||||||
<include refid="Example_Where_Clause" />
|
<if test="_parameter != null">
|
||||||
</if>
|
<include refid="Example_Where_Clause"/>
|
||||||
<if test="orderByClause != null">
|
</if>
|
||||||
order by ${orderByClause}
|
<if test="orderByClause != null">
|
||||||
</if>
|
order by ${orderByClause}
|
||||||
</select>
|
</if>
|
||||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestPlanApiScenarioExample" resultMap="BaseResultMap">
|
</select>
|
||||||
select
|
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestPlanApiScenarioExample"
|
||||||
<if test="distinct">
|
resultMap="BaseResultMap">
|
||||||
distinct
|
select
|
||||||
</if>
|
<if test="distinct">
|
||||||
<include refid="Base_Column_List" />
|
distinct
|
||||||
from test_plan_api_scenario
|
</if>
|
||||||
<if test="_parameter != null">
|
<include refid="Base_Column_List"/>
|
||||||
<include refid="Example_Where_Clause" />
|
from test_plan_api_scenario
|
||||||
</if>
|
<if test="_parameter != null">
|
||||||
<if test="orderByClause != null">
|
<include refid="Example_Where_Clause"/>
|
||||||
order by ${orderByClause}
|
</if>
|
||||||
</if>
|
<if test="orderByClause != null">
|
||||||
</select>
|
order by ${orderByClause}
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
</if>
|
||||||
select
|
</select>
|
||||||
<include refid="Base_Column_List" />
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||||
,
|
select
|
||||||
<include refid="Blob_Column_List" />
|
<include refid="Base_Column_List"/>
|
||||||
from test_plan_api_scenario
|
,
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
<include refid="Blob_Column_List"/>
|
||||||
</select>
|
from test_plan_api_scenario
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
delete from test_plan_api_scenario
|
</select>
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||||
</delete>
|
delete
|
||||||
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestPlanApiScenarioExample">
|
from test_plan_api_scenario
|
||||||
delete from test_plan_api_scenario
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
<if test="_parameter != null">
|
</delete>
|
||||||
<include refid="Example_Where_Clause" />
|
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestPlanApiScenarioExample">
|
||||||
</if>
|
delete from test_plan_api_scenario
|
||||||
</delete>
|
<if test="_parameter != null">
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
|
<include refid="Example_Where_Clause"/>
|
||||||
insert into test_plan_api_scenario (id, test_plan_id, api_scenario_id,
|
</if>
|
||||||
`status`, create_time, update_time,
|
</delete>
|
||||||
pass_rate, last_result, report_id,
|
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
|
||||||
create_user, `order`, environment_type,
|
insert into test_plan_api_scenario (id, test_plan_id, api_scenario_id,
|
||||||
environment_group_id, environment)
|
`status`, create_time, update_time,
|
||||||
values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{apiScenarioId,jdbcType=VARCHAR},
|
pass_rate, last_result, report_id,
|
||||||
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
create_user, `order`, environment_type,
|
||||||
#{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
|
environment_group_id, environment)
|
||||||
#{createUser,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT}, #{environmentType,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{apiScenarioId,jdbcType=VARCHAR},
|
||||||
#{environmentGroupId,jdbcType=VARCHAR}, #{environment,jdbcType=LONGVARCHAR})
|
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||||
</insert>
|
#{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
|
#{createUser,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT}, #{environmentType,jdbcType=VARCHAR},
|
||||||
insert into test_plan_api_scenario
|
#{environmentGroupId,jdbcType=VARCHAR}, #{environment,jdbcType=LONGVARCHAR})
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
</insert>
|
||||||
<if test="id != null">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
|
||||||
id,
|
insert into test_plan_api_scenario
|
||||||
</if>
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="testPlanId != null">
|
<if test="id != null">
|
||||||
test_plan_id,
|
id,
|
||||||
</if>
|
</if>
|
||||||
<if test="apiScenarioId != null">
|
<if test="testPlanId != null">
|
||||||
api_scenario_id,
|
test_plan_id,
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
<if test="apiScenarioId != null">
|
||||||
`status`,
|
api_scenario_id,
|
||||||
</if>
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="status != null">
|
||||||
create_time,
|
`status`,
|
||||||
</if>
|
</if>
|
||||||
<if test="updateTime != null">
|
<if test="createTime != null">
|
||||||
update_time,
|
create_time,
|
||||||
</if>
|
</if>
|
||||||
<if test="passRate != null">
|
<if test="updateTime != null">
|
||||||
pass_rate,
|
update_time,
|
||||||
</if>
|
</if>
|
||||||
<if test="lastResult != null">
|
<if test="passRate != null">
|
||||||
last_result,
|
pass_rate,
|
||||||
</if>
|
</if>
|
||||||
<if test="reportId != null">
|
<if test="lastResult != null">
|
||||||
report_id,
|
last_result,
|
||||||
</if>
|
</if>
|
||||||
<if test="createUser != null">
|
<if test="reportId != null">
|
||||||
create_user,
|
report_id,
|
||||||
</if>
|
</if>
|
||||||
<if test="order != null">
|
<if test="createUser != null">
|
||||||
`order`,
|
create_user,
|
||||||
</if>
|
</if>
|
||||||
<if test="environmentType != null">
|
<if test="order != null">
|
||||||
environment_type,
|
`order`,
|
||||||
</if>
|
</if>
|
||||||
<if test="environmentGroupId != null">
|
<if test="environmentType != null">
|
||||||
environment_group_id,
|
environment_type,
|
||||||
</if>
|
</if>
|
||||||
<if test="environment != null">
|
<if test="environmentGroupId != null">
|
||||||
environment,
|
environment_group_id,
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
<if test="environment != null">
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
environment,
|
||||||
<if test="id != null">
|
</if>
|
||||||
#{id,jdbcType=VARCHAR},
|
</trim>
|
||||||
</if>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="testPlanId != null">
|
<if test="id != null">
|
||||||
#{testPlanId,jdbcType=VARCHAR},
|
#{id,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="apiScenarioId != null">
|
<if test="testPlanId != null">
|
||||||
#{apiScenarioId,jdbcType=VARCHAR},
|
#{testPlanId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
<if test="apiScenarioId != null">
|
||||||
#{status,jdbcType=VARCHAR},
|
#{apiScenarioId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="status != null">
|
||||||
#{createTime,jdbcType=BIGINT},
|
#{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="updateTime != null">
|
<if test="createTime != null">
|
||||||
#{updateTime,jdbcType=BIGINT},
|
#{createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="passRate != null">
|
<if test="updateTime != null">
|
||||||
#{passRate,jdbcType=VARCHAR},
|
#{updateTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="lastResult != null">
|
<if test="passRate != null">
|
||||||
#{lastResult,jdbcType=VARCHAR},
|
#{passRate,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="reportId != null">
|
<if test="lastResult != null">
|
||||||
#{reportId,jdbcType=VARCHAR},
|
#{lastResult,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="createUser != null">
|
<if test="reportId != null">
|
||||||
#{createUser,jdbcType=VARCHAR},
|
#{reportId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="order != null">
|
<if test="createUser != null">
|
||||||
#{order,jdbcType=BIGINT},
|
#{createUser,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="environmentType != null">
|
<if test="order != null">
|
||||||
#{environmentType,jdbcType=VARCHAR},
|
#{order,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="environmentGroupId != null">
|
<if test="environmentType != null">
|
||||||
#{environmentGroupId,jdbcType=VARCHAR},
|
#{environmentType,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="environment != null">
|
<if test="environmentGroupId != null">
|
||||||
#{environment,jdbcType=LONGVARCHAR},
|
#{environmentGroupId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
<if test="environment != null">
|
||||||
</insert>
|
#{environment,jdbcType=LONGVARCHAR},
|
||||||
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanApiScenarioExample" resultType="java.lang.Long">
|
</if>
|
||||||
select count(*) from test_plan_api_scenario
|
</trim>
|
||||||
<if test="_parameter != null">
|
</insert>
|
||||||
<include refid="Example_Where_Clause" />
|
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanApiScenarioExample"
|
||||||
</if>
|
resultType="java.lang.Long">
|
||||||
</select>
|
select count(*) from test_plan_api_scenario
|
||||||
<update id="updateByExampleSelective" parameterType="map">
|
<if test="_parameter != null">
|
||||||
update test_plan_api_scenario
|
<include refid="Example_Where_Clause"/>
|
||||||
<set>
|
</if>
|
||||||
<if test="record.id != null">
|
</select>
|
||||||
id = #{record.id,jdbcType=VARCHAR},
|
|
||||||
</if>
|
<select id="selectReportEnvConfByResourceIds" resultType="java.lang.String">
|
||||||
<if test="record.testPlanId != null">
|
SELECT env_config FROM api_scenario_report WHERE id IN (
|
||||||
|
select report_id FROM test_plan_api_scenario WHERE id IN
|
||||||
|
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</select>
|
||||||
|
<update id="updateByExampleSelective" parameterType="map">
|
||||||
|
update test_plan_api_scenario
|
||||||
|
<set>
|
||||||
|
<if test="record.id != null">
|
||||||
|
id = #{record.id,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.testPlanId != null">
|
||||||
|
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.apiScenarioId != null">
|
||||||
|
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.status != null">
|
||||||
|
`status` = #{record.status,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.createTime != null">
|
||||||
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="record.updateTime != null">
|
||||||
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="record.passRate != null">
|
||||||
|
pass_rate = #{record.passRate,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.lastResult != null">
|
||||||
|
last_result = #{record.lastResult,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.reportId != null">
|
||||||
|
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.createUser != null">
|
||||||
|
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.order != null">
|
||||||
|
`order` = #{record.order,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="record.environmentType != null">
|
||||||
|
environment_type = #{record.environmentType,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.environmentGroupId != null">
|
||||||
|
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="record.environment != null">
|
||||||
|
environment = #{record.environment,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
<if test="_parameter != null">
|
||||||
|
<include refid="Update_By_Example_Where_Clause"/>
|
||||||
|
</if>
|
||||||
|
</update>
|
||||||
|
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||||
|
update test_plan_api_scenario
|
||||||
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.apiScenarioId != null">
|
|
||||||
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
|
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.status != null">
|
|
||||||
`status` = #{record.status,jdbcType=VARCHAR},
|
`status` = #{record.status,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.createTime != null">
|
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
</if>
|
|
||||||
<if test="record.updateTime != null">
|
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
</if>
|
|
||||||
<if test="record.passRate != null">
|
|
||||||
pass_rate = #{record.passRate,jdbcType=VARCHAR},
|
pass_rate = #{record.passRate,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.lastResult != null">
|
|
||||||
last_result = #{record.lastResult,jdbcType=VARCHAR},
|
last_result = #{record.lastResult,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.reportId != null">
|
|
||||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.createUser != null">
|
|
||||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.order != null">
|
|
||||||
`order` = #{record.order,jdbcType=BIGINT},
|
`order` = #{record.order,jdbcType=BIGINT},
|
||||||
</if>
|
|
||||||
<if test="record.environmentType != null">
|
|
||||||
environment_type = #{record.environmentType,jdbcType=VARCHAR},
|
environment_type = #{record.environmentType,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="record.environmentGroupId != null">
|
|
||||||
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
|
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
|
||||||
</if>
|
environment = #{record.environment,jdbcType=LONGVARCHAR}
|
||||||
<if test="record.environment != null">
|
<if test="_parameter != null">
|
||||||
environment = #{record.environment,jdbcType=LONGVARCHAR},
|
<include refid="Update_By_Example_Where_Clause"/>
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</update>
|
||||||
<if test="_parameter != null">
|
<update id="updateByExample" parameterType="map">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
update test_plan_api_scenario
|
||||||
</if>
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
</update>
|
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
|
||||||
update test_plan_api_scenario
|
`status` = #{record.status,jdbcType=VARCHAR},
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
|
pass_rate = #{record.passRate,jdbcType=VARCHAR},
|
||||||
`status` = #{record.status,jdbcType=VARCHAR},
|
last_result = #{record.lastResult,jdbcType=VARCHAR},
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||||
pass_rate = #{record.passRate,jdbcType=VARCHAR},
|
`order` = #{record.order,jdbcType=BIGINT},
|
||||||
last_result = #{record.lastResult,jdbcType=VARCHAR},
|
environment_type = #{record.environmentType,jdbcType=VARCHAR},
|
||||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR}
|
||||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
<if test="_parameter != null">
|
||||||
`order` = #{record.order,jdbcType=BIGINT},
|
<include refid="Update_By_Example_Where_Clause"/>
|
||||||
environment_type = #{record.environmentType,jdbcType=VARCHAR},
|
</if>
|
||||||
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR},
|
</update>
|
||||||
environment = #{record.environment,jdbcType=LONGVARCHAR}
|
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
|
||||||
<if test="_parameter != null">
|
update test_plan_api_scenario
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<set>
|
||||||
</if>
|
<if test="testPlanId != null">
|
||||||
</update>
|
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||||
<update id="updateByExample" parameterType="map">
|
</if>
|
||||||
update test_plan_api_scenario
|
<if test="apiScenarioId != null">
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
|
||||||
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
</if>
|
||||||
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
|
<if test="status != null">
|
||||||
`status` = #{record.status,jdbcType=VARCHAR},
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
</if>
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
<if test="createTime != null">
|
||||||
pass_rate = #{record.passRate,jdbcType=VARCHAR},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
last_result = #{record.lastResult,jdbcType=VARCHAR},
|
</if>
|
||||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
<if test="updateTime != null">
|
||||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
`order` = #{record.order,jdbcType=BIGINT},
|
</if>
|
||||||
environment_type = #{record.environmentType,jdbcType=VARCHAR},
|
<if test="passRate != null">
|
||||||
environment_group_id = #{record.environmentGroupId,jdbcType=VARCHAR}
|
pass_rate = #{passRate,jdbcType=VARCHAR},
|
||||||
<if test="_parameter != null">
|
</if>
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<if test="lastResult != null">
|
||||||
</if>
|
last_result = #{lastResult,jdbcType=VARCHAR},
|
||||||
</update>
|
</if>
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
|
<if test="reportId != null">
|
||||||
update test_plan_api_scenario
|
report_id = #{reportId,jdbcType=VARCHAR},
|
||||||
<set>
|
</if>
|
||||||
<if test="testPlanId != null">
|
<if test="createUser != null">
|
||||||
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
create_user = #{createUser,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="apiScenarioId != null">
|
<if test="order != null">
|
||||||
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
|
`order` = #{order,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
<if test="environmentType != null">
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
environment_type = #{environmentType,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="environmentGroupId != null">
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="updateTime != null">
|
<if test="environment != null">
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
environment = #{environment,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="passRate != null">
|
</set>
|
||||||
pass_rate = #{passRate,jdbcType=VARCHAR},
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</if>
|
</update>
|
||||||
<if test="lastResult != null">
|
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
|
||||||
last_result = #{lastResult,jdbcType=VARCHAR},
|
update test_plan_api_scenario
|
||||||
</if>
|
set test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||||
<if test="reportId != null">
|
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
|
||||||
report_id = #{reportId,jdbcType=VARCHAR},
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
</if>
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
<if test="createUser != null">
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
create_user = #{createUser,jdbcType=VARCHAR},
|
pass_rate = #{passRate,jdbcType=VARCHAR},
|
||||||
</if>
|
last_result = #{lastResult,jdbcType=VARCHAR},
|
||||||
<if test="order != null">
|
report_id = #{reportId,jdbcType=VARCHAR},
|
||||||
`order` = #{order,jdbcType=BIGINT},
|
create_user = #{createUser,jdbcType=VARCHAR},
|
||||||
</if>
|
`order` = #{order,jdbcType=BIGINT},
|
||||||
<if test="environmentType != null">
|
environment_type = #{environmentType,jdbcType=VARCHAR},
|
||||||
environment_type = #{environmentType,jdbcType=VARCHAR},
|
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
|
||||||
</if>
|
environment = #{environment,jdbcType=LONGVARCHAR}
|
||||||
<if test="environmentGroupId != null">
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
|
</update>
|
||||||
</if>
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
|
||||||
<if test="environment != null">
|
update test_plan_api_scenario
|
||||||
environment = #{environment,jdbcType=LONGVARCHAR},
|
set test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||||
</if>
|
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
|
||||||
</set>
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
</update>
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
|
pass_rate = #{passRate,jdbcType=VARCHAR},
|
||||||
update test_plan_api_scenario
|
last_result = #{lastResult,jdbcType=VARCHAR},
|
||||||
set test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
report_id = #{reportId,jdbcType=VARCHAR},
|
||||||
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
|
create_user = #{createUser,jdbcType=VARCHAR},
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
`order` = #{order,jdbcType=BIGINT},
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
environment_type = #{environmentType,jdbcType=VARCHAR},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR}
|
||||||
pass_rate = #{passRate,jdbcType=VARCHAR},
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
last_result = #{lastResult,jdbcType=VARCHAR},
|
</update>
|
||||||
report_id = #{reportId,jdbcType=VARCHAR},
|
|
||||||
create_user = #{createUser,jdbcType=VARCHAR},
|
|
||||||
`order` = #{order,jdbcType=BIGINT},
|
|
||||||
environment_type = #{environmentType,jdbcType=VARCHAR},
|
|
||||||
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR},
|
|
||||||
environment = #{environment,jdbcType=LONGVARCHAR}
|
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
|
||||||
</update>
|
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlanApiScenario">
|
|
||||||
update test_plan_api_scenario
|
|
||||||
set test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
|
||||||
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
|
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
|
||||||
pass_rate = #{passRate,jdbcType=VARCHAR},
|
|
||||||
last_result = #{lastResult,jdbcType=VARCHAR},
|
|
||||||
report_id = #{reportId,jdbcType=VARCHAR},
|
|
||||||
create_user = #{createUser,jdbcType=VARCHAR},
|
|
||||||
`order` = #{order,jdbcType=BIGINT},
|
|
||||||
environment_type = #{environmentType,jdbcType=VARCHAR},
|
|
||||||
environment_group_id = #{environmentGroupId,jdbcType=VARCHAR}
|
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
|
||||||
</update>
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -56,4 +56,6 @@ public interface ExtApiDefinitionExecResultMapper {
|
||||||
List<ApiDefinitionExecResultWithBLOBs> selectRerunResult(@Param("reportId") String reportId);
|
List<ApiDefinitionExecResultWithBLOBs> selectRerunResult(@Param("reportId") String reportId);
|
||||||
|
|
||||||
List<String> selectByProjectIdAndLessThanTime(@Param("projectId") String projectId, @Param("time") long time);
|
List<String> selectByProjectIdAndLessThanTime(@Param("projectId") String projectId, @Param("time") long time);
|
||||||
|
|
||||||
|
List<ApiDefinitionExecResultWithBLOBs> selectByResourceIdsAndMaxCreateTime(@Param("ids") List<String> resourceIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,6 +416,17 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="selectByResourceIdsAndMaxCreateTime"
|
||||||
|
resultType="io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs">
|
||||||
|
SELECT resource_id,max(create_time) AS create_time, id, env_config, project_id FROM api_definition_exec_result
|
||||||
|
WHERE
|
||||||
|
resource_id IN
|
||||||
|
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY resource_id;
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="findByProjectIds" resultType="io.metersphere.base.domain.ApiDefinitionExecResult"
|
<select id="findByProjectIds" resultType="io.metersphere.base.domain.ApiDefinitionExecResult"
|
||||||
parameterType="java.lang.String">
|
parameterType="java.lang.String">
|
||||||
select actuator ,id from api_definition_exec_result where status in ("running","starting","waiting") and
|
select actuator ,id from api_definition_exec_result where status in ("running","starting","waiting") and
|
||||||
|
@ -431,20 +442,21 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectRerunResult" resultType="io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs">
|
<select id="selectRerunResult" resultType="io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs">
|
||||||
SELECT
|
SELECT r.*
|
||||||
r.*
|
FROM api_definition_exec_result r
|
||||||
FROM
|
INNER JOIN api_test_case c ON r.resource_id = c.id
|
||||||
api_definition_exec_result r
|
|
||||||
INNER JOIN api_test_case c ON r.resource_id = c.id
|
|
||||||
AND c.`status` != 'Trash'
|
AND c.`status` != 'Trash'
|
||||||
WHERE
|
WHERE
|
||||||
r.STATUS != 'success'
|
r.STATUS != 'success'
|
||||||
AND r.integrated_report_id = #{reportId}
|
AND r.integrated_report_id = #{reportId}
|
||||||
ORDER BY
|
ORDER BY
|
||||||
r.create_time ASC
|
r.create_time ASC
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByProjectIdAndLessThanTime" resultType="java.lang.String">
|
<select id="selectByProjectIdAndLessThanTime" resultType="java.lang.String">
|
||||||
select id from api_definition_exec_result where project_id = #{projectId} and create_time < #{time}
|
select id
|
||||||
|
from api_definition_exec_result
|
||||||
|
where project_id = #{projectId}
|
||||||
|
and create_time < #{time}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -10,7 +10,9 @@ import io.metersphere.api.dto.definition.ApiTestCaseRequest;
|
||||||
import io.metersphere.api.dto.definition.BatchRunDefinitionRequest;
|
import io.metersphere.api.dto.definition.BatchRunDefinitionRequest;
|
||||||
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
|
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
|
||||||
import io.metersphere.api.exec.api.ApiCaseExecuteService;
|
import io.metersphere.api.exec.api.ApiCaseExecuteService;
|
||||||
|
import io.metersphere.api.exec.scenario.ApiScenarioEnvService;
|
||||||
import io.metersphere.api.service.ApiDefinitionExecResultService;
|
import io.metersphere.api.service.ApiDefinitionExecResultService;
|
||||||
|
import io.metersphere.api.service.ApiDefinitionService;
|
||||||
import io.metersphere.api.service.ApiTestCaseService;
|
import io.metersphere.api.service.ApiTestCaseService;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
||||||
|
@ -29,6 +31,7 @@ import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
|
||||||
import io.metersphere.track.dto.TestPlanApiResultReportDTO;
|
import io.metersphere.track.dto.TestPlanApiResultReportDTO;
|
||||||
import io.metersphere.track.dto.TestPlanSimpleReportDTO;
|
import io.metersphere.track.dto.TestPlanSimpleReportDTO;
|
||||||
import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest;
|
import io.metersphere.track.request.testcase.TestPlanApiCaseBatchRequest;
|
||||||
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.ibatis.session.ExecutorType;
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
@ -69,6 +72,11 @@ public class TestPlanApiCaseService {
|
||||||
private TestPlanService testPlanService;
|
private TestPlanService testPlanService;
|
||||||
@Resource
|
@Resource
|
||||||
private EnvironmentGroupProjectService environmentGroupProjectService;
|
private EnvironmentGroupProjectService environmentGroupProjectService;
|
||||||
|
@Resource
|
||||||
|
private ApiDefinitionService apiDefinitionService;
|
||||||
|
@Resource
|
||||||
|
private ApiScenarioEnvService apiScenarioEnvService;
|
||||||
|
|
||||||
|
|
||||||
public TestPlanApiCase getInfo(String caseId, String testPlanId) {
|
public TestPlanApiCase getInfo(String caseId, String testPlanId) {
|
||||||
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
|
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
|
||||||
|
@ -135,7 +143,7 @@ public class TestPlanApiCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deleteByCaseId(String caseId) {
|
public int deleteByCaseId(String caseId) {
|
||||||
return this.deleteByCaseIds(Arrays.asList(caseId));
|
return this.deleteByCaseIds(Arrays.asList(caseId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deleteByCaseIds(List<String> caseIds) {
|
public int deleteByCaseIds(List<String> caseIds) {
|
||||||
|
@ -368,9 +376,66 @@ public class TestPlanApiCaseService {
|
||||||
return extTestPlanApiCaseMapper.getApiTestCaseById(testPlanApiCaseId);
|
return extTestPlanApiCaseMapper.getApiTestCaseById(testPlanApiCaseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算测试计划中接口用例的相关数据
|
||||||
|
*
|
||||||
|
* @param planId
|
||||||
|
* @param report
|
||||||
|
* @return 接口用例的最新执行报告
|
||||||
|
*/
|
||||||
public void calculatePlanReport(String planId, TestPlanSimpleReportDTO report) {
|
public void calculatePlanReport(String planId, TestPlanSimpleReportDTO report) {
|
||||||
List<PlanReportCaseDTO> planReportCaseDTOS = extTestPlanApiCaseMapper.selectForPlanReport(planId);
|
List<PlanReportCaseDTO> planReportCaseDTOS = extTestPlanApiCaseMapper.selectForPlanReport(planId);
|
||||||
|
//计算测试计划中接口用例的相关数据
|
||||||
calculatePlanReport(report, planReportCaseDTOS);
|
calculatePlanReport(report, planReportCaseDTOS);
|
||||||
|
//记录接口用例的运行环境信息
|
||||||
|
List<String> idList = planReportCaseDTOS.stream().map(PlanReportCaseDTO::getId).collect(Collectors.toList());
|
||||||
|
this.initProjectEnvironment(report, idList, "ApiCase");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化项目环境信息
|
||||||
|
*
|
||||||
|
* @param report
|
||||||
|
* @param resourceIds 资源ID
|
||||||
|
* @param resourceType 资源类型 ApiCase/Scenario
|
||||||
|
*/
|
||||||
|
public void initProjectEnvironment(TestPlanSimpleReportDTO report, List<String> resourceIds, String resourceType) {
|
||||||
|
if (!CollectionUtils.isEmpty(resourceIds)) {
|
||||||
|
if (StringUtils.equalsIgnoreCase("ApiCase", resourceType)) {
|
||||||
|
List<ApiDefinitionExecResultWithBLOBs> execResults = apiDefinitionExecResultService.selectByResourceIdsAndMaxCreateTime(resourceIds);
|
||||||
|
execResults.forEach(item -> {
|
||||||
|
String envConf = item.getEnvConfig();
|
||||||
|
String projectId = item.getProjectId();
|
||||||
|
Map<String, List<String>> projectEnvMap = apiDefinitionService.getProjectEnvNameByEnvConfig(projectId, envConf);
|
||||||
|
this.setProjectEnvMap(report, projectEnvMap);
|
||||||
|
});
|
||||||
|
} else if (StringUtils.equalsIgnoreCase("Scenario", resourceType)) {
|
||||||
|
Map<String, List<String>> projectEnvMap = apiScenarioEnvService.selectProjectEnvMapByTestPlanScenarioIds(resourceIds);
|
||||||
|
this.setProjectEnvMap(report, projectEnvMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setProjectEnvMap(TestPlanSimpleReportDTO report, Map<String, List<String>> projectEnvMap) {
|
||||||
|
if (report != null && MapUtils.isNotEmpty(projectEnvMap)) {
|
||||||
|
if (report.getProjectEnvMap() == null) {
|
||||||
|
report.setProjectEnvMap(new LinkedHashMap<>());
|
||||||
|
}
|
||||||
|
for (Map.Entry<String, List<String>> entry : projectEnvMap.entrySet()) {
|
||||||
|
String projectName = entry.getKey();
|
||||||
|
List<String> envNameList = entry.getValue();
|
||||||
|
if (report.getProjectEnvMap().containsKey(projectName)) {
|
||||||
|
envNameList.forEach(envName -> {
|
||||||
|
if (!report.getProjectEnvMap().get(projectName).contains(envName)) {
|
||||||
|
report.getProjectEnvMap().get(projectName).add(envName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
report.getProjectEnvMap().put(projectName, envNameList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculatePlanReport(List<String> apiReportIds, TestPlanSimpleReportDTO report) {
|
public void calculatePlanReport(List<String> apiReportIds, TestPlanSimpleReportDTO report) {
|
||||||
|
|
|
@ -72,6 +72,8 @@ public class TestPlanScenarioCaseService {
|
||||||
private TestPlanService testPlanService;
|
private TestPlanService testPlanService;
|
||||||
@Resource
|
@Resource
|
||||||
private ProjectApplicationService projectApplicationService;
|
private ProjectApplicationService projectApplicationService;
|
||||||
|
@Resource
|
||||||
|
private TestPlanApiCaseService testPlanApiCaseService;
|
||||||
|
|
||||||
public List<ApiScenarioDTO> list(TestPlanScenarioRequest request) {
|
public List<ApiScenarioDTO> list(TestPlanScenarioRequest request) {
|
||||||
request.setProjectId(null);
|
request.setProjectId(null);
|
||||||
|
@ -96,15 +98,15 @@ public class TestPlanScenarioCaseService {
|
||||||
|
|
||||||
apiTestCases.forEach(item -> {
|
apiTestCases.forEach(item -> {
|
||||||
Project project = projectMap.get(item.getProjectId());
|
Project project = projectMap.get(item.getProjectId());
|
||||||
if(project != null){
|
if (project != null) {
|
||||||
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.SCENARIO_CUSTOM_NUM.name());
|
ProjectConfig config = projectApplicationService.getSpecificTypeValue(project.getId(), ProjectApplicationType.SCENARIO_CUSTOM_NUM.name());
|
||||||
boolean custom = config.getScenarioCustomNum();
|
boolean custom = config.getScenarioCustomNum();
|
||||||
if (custom) {
|
if (custom) {
|
||||||
item.setCustomNum(item.getCustomNum());
|
item.setCustomNum(item.getCustomNum());
|
||||||
}else {
|
} else {
|
||||||
item.setCustomNum(item.getNum().toString());
|
item.setCustomNum(item.getNum().toString());
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
item.setCustomNum(item.getNum().toString());
|
item.setCustomNum(item.getNum().toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -492,6 +494,9 @@ public class TestPlanScenarioCaseService {
|
||||||
public void calculatePlanReport(String planId, TestPlanSimpleReportDTO report) {
|
public void calculatePlanReport(String planId, TestPlanSimpleReportDTO report) {
|
||||||
List<PlanReportCaseDTO> planReportCaseDTOS = extTestPlanScenarioCaseMapper.selectForPlanReport(planId);
|
List<PlanReportCaseDTO> planReportCaseDTOS = extTestPlanScenarioCaseMapper.selectForPlanReport(planId);
|
||||||
calculatePlanReport(report, planReportCaseDTOS);
|
calculatePlanReport(report, planReportCaseDTOS);
|
||||||
|
//记录接口用例的运行环境信息
|
||||||
|
List<String> idList = planReportCaseDTOS.stream().map(PlanReportCaseDTO::getId).collect(Collectors.toList());
|
||||||
|
testPlanApiCaseService.initProjectEnvironment(report, idList, "Scenario");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculatePlanReport(List<String> reportIds, TestPlanSimpleReportDTO report) {
|
public void calculatePlanReport(List<String> reportIds, TestPlanSimpleReportDTO report) {
|
||||||
|
@ -499,7 +504,7 @@ public class TestPlanScenarioCaseService {
|
||||||
calculatePlanReport(report, planReportCaseDTOS);
|
calculatePlanReport(report, planReportCaseDTOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculatePlanReportByScenarioList(List<TestPlanFailureScenarioDTO> scenarioList,TestPlanSimpleReportDTO report){
|
public void calculatePlanReportByScenarioList(List<TestPlanFailureScenarioDTO> scenarioList, TestPlanSimpleReportDTO report) {
|
||||||
List<PlanReportCaseDTO> planReportCaseDTOS = new ArrayList<>();
|
List<PlanReportCaseDTO> planReportCaseDTOS = new ArrayList<>();
|
||||||
for (TestPlanFailureScenarioDTO scenario : scenarioList) {
|
for (TestPlanFailureScenarioDTO scenario : scenarioList) {
|
||||||
PlanReportCaseDTO dto = new PlanReportCaseDTO();
|
PlanReportCaseDTO dto = new PlanReportCaseDTO();
|
||||||
|
@ -545,7 +550,7 @@ public class TestPlanScenarioCaseService {
|
||||||
private void calculateScenarioResultDTO(PlanReportCaseDTO item,
|
private void calculateScenarioResultDTO(PlanReportCaseDTO item,
|
||||||
TestPlanScenarioStepCountDTO stepCount) {
|
TestPlanScenarioStepCountDTO stepCount) {
|
||||||
if (StringUtils.isNotBlank(item.getReportId())) {
|
if (StringUtils.isNotBlank(item.getReportId())) {
|
||||||
APIScenarioReportResult apiScenarioReportResult = apiScenarioReportService.get(item.getReportId(),false);
|
APIScenarioReportResult apiScenarioReportResult = apiScenarioReportService.get(item.getReportId(), false);
|
||||||
if (apiScenarioReportResult != null) {
|
if (apiScenarioReportResult != null) {
|
||||||
String content = apiScenarioReportResult.getContent();
|
String content = apiScenarioReportResult.getContent();
|
||||||
if (StringUtils.isNotBlank(content)) {
|
if (StringUtils.isNotBlank(content)) {
|
||||||
|
|
|
@ -60,7 +60,8 @@
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:button v-if="!ifFromVariableAdvance">
|
<template v-slot:button v-if="!ifFromVariableAdvance">
|
||||||
<el-tooltip :content="$t('api_test.run')" placement="top" v-if="!loading">
|
<el-tooltip :content="$t('api_test.run')" placement="top" v-if="!loading">
|
||||||
<el-button :disabled="!request.enable" @click="run" icon="el-icon-video-play" class="ms-btn" size="mini" circle/>
|
<el-button :disabled="!request.enable" @click="run" icon="el-icon-video-play" class="ms-btn" size="mini"
|
||||||
|
circle/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else>
|
<el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else>
|
||||||
<el-button @click.once="stop" size="mini" style="color:white;padding: 0 0.1px;width: 24px;height: 24px;"
|
<el-button @click.once="stop" size="mini" style="color:white;padding: 0 0.1px;width: 24px;height: 24px;"
|
||||||
|
@ -167,7 +168,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getUUID, getCurrentProjectID, getCurrentWorkspaceId} from "@/common/js/utils";
|
import {getCurrentProjectID, getCurrentWorkspaceId, getUUID} from "@/common/js/utils";
|
||||||
import {getUrl} from "@/business/components/api/automation/scenario/component/urlhelper";
|
import {getUrl} from "@/business/components/api/automation/scenario/component/urlhelper";
|
||||||
|
|
||||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||||
|
@ -645,7 +646,7 @@ export default {
|
||||||
resource.protocol = 'DUBBO'
|
resource.protocol = 'DUBBO'
|
||||||
}
|
}
|
||||||
let definitionData = this.$router.resolve({
|
let definitionData = this.$router.resolve({
|
||||||
name: 'ApiDefinition',
|
name: 'ApiDefinitionWithQuery',
|
||||||
params: {
|
params: {
|
||||||
redirectID: getUUID(),
|
redirectID: getUUID(),
|
||||||
dataType: "api",
|
dataType: "api",
|
||||||
|
|
|
@ -32,9 +32,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:behindHeaderLeft>
|
<template v-slot:behindHeaderLeft>
|
||||||
<el-tag size="small" class="ms-tag" v-if="scenario.referenced==='Deleted'" type="danger">{{ $t('api_test.automation.reference_deleted') }}</el-tag>
|
<el-tag size="small" class="ms-tag" v-if="scenario.referenced==='Deleted'" type="danger">
|
||||||
|
{{ $t('api_test.automation.reference_deleted') }}
|
||||||
|
</el-tag>
|
||||||
<el-tag size="small" class="ms-tag" v-if="scenario.referenced==='Copy'">{{ $t('commons.copy') }}</el-tag>
|
<el-tag size="small" class="ms-tag" v-if="scenario.referenced==='Copy'">{{ $t('commons.copy') }}</el-tag>
|
||||||
<el-tag size="small" class="ms-tag" v-if="scenario.referenced==='REF'">{{ $t('api_test.scenario.reference') }}</el-tag>
|
<el-tag size="small" class="ms-tag" v-if="scenario.referenced==='REF'">{{
|
||||||
|
$t('api_test.scenario.reference')
|
||||||
|
}}
|
||||||
|
</el-tag>
|
||||||
<span class="ms-tag ms-step-name-api">{{ getProjectName(scenario.projectId) }}</span>
|
<span class="ms-tag ms-step-name-api">{{ getProjectName(scenario.projectId) }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:debugStepCode>
|
<template v-slot:debugStepCode>
|
||||||
|
@ -42,16 +47,19 @@
|
||||||
<i class="el-icon-loading" style="font-size: 16px"/>
|
<i class="el-icon-loading" style="font-size: 16px"/>
|
||||||
{{ $t('commons.testing') }}
|
{{ $t('commons.testing') }}
|
||||||
</span>
|
</span>
|
||||||
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'" v-if="!loading && node.data.debug && !node.data.testing">
|
<span class="ms-step-debug-code" :class="node.data.code ==='error'?'ms-req-error':'ms-req-success'"
|
||||||
|
v-if="!loading && node.data.debug && !node.data.testing">
|
||||||
{{ getCode() }}
|
{{ getCode() }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:button v-if="!ifFromVariableAdvance">
|
<template v-slot:button v-if="!ifFromVariableAdvance">
|
||||||
<el-tooltip :content="$t('api_test.run')" placement="top" v-if="!scenario.run">
|
<el-tooltip :content="$t('api_test.run')" placement="top" v-if="!scenario.run">
|
||||||
<el-button :disabled="!scenario.enable" @click="run" icon="el-icon-video-play" style="padding: 5px" class="ms-btn" size="mini" circle/>
|
<el-button :disabled="!scenario.enable" @click="run" icon="el-icon-video-play" style="padding: 5px"
|
||||||
|
class="ms-btn" size="mini" circle/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else>
|
<el-tooltip :content="$t('report.stop_btn')" placement="top" :enterable="false" v-else>
|
||||||
<el-button :disabled="!scenario.enable" @click.once="stop" size="mini" style="color:white;padding: 0 0.1px;width: 24px;height: 24px;" class="stop-btn" circle>
|
<el-button :disabled="!scenario.enable" @click.once="stop" size="mini"
|
||||||
|
style="color:white;padding: 0 0.1px;width: 24px;height: 24px;" class="stop-btn" circle>
|
||||||
<div style="transform: scale(0.66)">
|
<div style="transform: scale(0.66)">
|
||||||
<span style="margin-left: -4.5px;font-weight: bold;">STOP</span>
|
<span style="margin-left: -4.5px;font-weight: bold;">STOP</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -286,8 +294,14 @@ export default {
|
||||||
},
|
},
|
||||||
gotoTurn(resource, workspaceId, isTurnSpace) {
|
gotoTurn(resource, workspaceId, isTurnSpace) {
|
||||||
let automationData = this.$router.resolve({
|
let automationData = this.$router.resolve({
|
||||||
name: 'ApiAutomation',
|
name: 'ApiAutomationWithQuery',
|
||||||
params: {redirectID: getUUID(), dataType: "scenario", dataSelectRange: 'edit:' + resource.id, projectId: resource.projectId, workspaceId: workspaceId}
|
params: {
|
||||||
|
redirectID: getUUID(),
|
||||||
|
dataType: "scenario",
|
||||||
|
dataSelectRange: 'edit:' + resource.id,
|
||||||
|
projectId: resource.projectId,
|
||||||
|
workspaceId: workspaceId
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (isTurnSpace) {
|
if (isTurnSpace) {
|
||||||
window.open(automationData.href, '_blank');
|
window.open(automationData.href, '_blank');
|
||||||
|
|
|
@ -6,18 +6,19 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-row type="flex" class="select-time"
|
<el-row type="flex" class="select-time"
|
||||||
v-if="report.envGroupName || report.projectEnvMap">
|
v-if="report.envGroupName || report.projectEnvMap">
|
||||||
<span> {{ $t('commons.environment') + ':' }} </span>
|
<el-form-item :label="$t('commons.environment') + ':'" style="width: 100%">
|
||||||
<div v-if="report.envGroupName" style="margin-left: 12px">
|
<div v-if="report.envGroupName" style="margin-left: 12px">
|
||||||
<ms-tag type="danger" :content="$t('commons.group')"></ms-tag>
|
<ms-tag type="danger" :content="$t('commons.group')"></ms-tag>
|
||||||
{{ report.envGroupName }}
|
{{ report.envGroupName }}
|
||||||
</div>
|
|
||||||
<div v-else-if="report.projectEnvMap" style="margin-left: 12px">
|
|
||||||
<div v-for="(values,key) in report.projectEnvMap" :key="key" style="margin-right: 10px">
|
|
||||||
{{ key + ":" }}
|
|
||||||
<ms-tag v-for="(item,index) in values" :key="index" type="success" :content="item"
|
|
||||||
style="margin-left: 2px"/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div v-else-if="report.projectEnvMap" style="margin-left: 12px">
|
||||||
|
<div v-for="(values,key) in report.projectEnvMap" :key="key" style="margin-right: 10px">
|
||||||
|
{{ key + ":" }}
|
||||||
|
<ms-tag v-for="(item,index) in values" :key="index" type="success" :content="item"
|
||||||
|
style="margin-left: 2px"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row type="flex" justify="space-between" class="select-time">
|
<el-row type="flex" justify="space-between" class="select-time">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
|
|
Loading…
Reference in New Issue