refactor (接口测试): 优化测试报告加载
This commit is contained in:
parent
2b6ee03d83
commit
dd997bb458
|
@ -2,8 +2,6 @@ package io.metersphere.api.exec.api;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.api.dto.ApiCaseRunRequest;
|
||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
||||
import io.metersphere.api.dto.automation.ExecuteType;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
|
||||
import io.metersphere.api.dto.definition.BatchRunDefinitionRequest;
|
||||
import io.metersphere.api.dto.scenario.DatabaseConfig;
|
||||
|
@ -18,7 +16,10 @@ import io.metersphere.base.mapper.ApiTestCaseMapper;
|
|||
import io.metersphere.base.mapper.TestPlanApiCaseMapper;
|
||||
import io.metersphere.base.mapper.TestPlanMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiTestCaseMapper;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.constants.APITestStatus;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.ReportTypeConstants;
|
||||
import io.metersphere.commons.constants.TriggerMode;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
|
@ -211,19 +212,16 @@ public class ApiCaseExecuteService {
|
|||
if (StringUtils.equals(request.getConfig().getReportType(), RunModeConstants.SET_REPORT.toString())
|
||||
&& StringUtils.isNotEmpty(request.getConfig().getReportName())) {
|
||||
serialReportId = UUID.randomUUID().toString();
|
||||
APIScenarioReportResult report = apiScenarioReportService.init(request.getConfig().getReportId(), null, request.getConfig().getReportName(),
|
||||
ReportTriggerMode.BATCH.name(), ExecuteType.Saved.name(), request.getProjectId(),
|
||||
null, request.getConfig());
|
||||
report.setVersionId(caseList.get(0).getVersionId());
|
||||
ApiDefinitionExecResult report = ApiDefinitionExecResultUtil.initBase(null, APITestStatus.Running.name(), serialReportId, request.getConfig());
|
||||
report.setName(request.getConfig().getReportName());
|
||||
report.setTestName(request.getConfig().getReportName());
|
||||
report.setId(serialReportId);
|
||||
report.setProjectId(request.getProjectId());
|
||||
report.setReportType(ReportTypeConstants.API_INTEGRATED.name());
|
||||
request.getConfig().setAmassReport(serialReportId);
|
||||
report.setStatus(APITestStatus.Running.name());
|
||||
apiScenarioReportMapper.insert(report);
|
||||
report.setVersionId(caseList.get(0).getVersionId());
|
||||
Map<String, ApiDefinitionExecResult> executeQueue = new LinkedHashMap<>();
|
||||
executeQueue.put(serialReportId, report);
|
||||
|
||||
apiScenarioReportStructureService.save(serialReportId, new ArrayList<>());
|
||||
apiCaseResultService.batchSave(executeQueue);
|
||||
}
|
||||
|
||||
if (request.getConfig() != null && request.getConfig().getMode().equals(RunModeConstants.SERIAL.toString())) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
|||
import io.metersphere.base.domain.TestPlanApiCase;
|
||||
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.ReportTypeConstants;
|
||||
import io.metersphere.commons.constants.TriggerMode;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
|
@ -33,6 +34,7 @@ public class ApiDefinitionExecResultUtil {
|
|||
}
|
||||
apiResult.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||
apiResult.setResourceId(resourceId);
|
||||
apiResult.setReportType(ReportTypeConstants.API_INDEPENDENT.name());
|
||||
apiResult.setStartTime(System.currentTimeMillis());
|
||||
apiResult.setType(ApiRunMode.DEFINITION.name());
|
||||
apiResult.setStatus(status);
|
||||
|
@ -45,6 +47,7 @@ public class ApiDefinitionExecResultUtil {
|
|||
apiResult.setCreateTime(System.currentTimeMillis());
|
||||
apiResult.setStartTime(System.currentTimeMillis());
|
||||
apiResult.setEndTime(System.currentTimeMillis());
|
||||
apiResult.setReportType(ReportTypeConstants.API_INDEPENDENT.name());
|
||||
ApiTestCaseWithBLOBs caseWithBLOBs = CommonBeanFactory.getBean(ApiTestCaseMapper.class).selectByPrimaryKey(key.getApiCaseId());
|
||||
if (caseWithBLOBs != null) {
|
||||
apiResult.setName(caseWithBLOBs.getName());
|
||||
|
@ -79,6 +82,7 @@ public class ApiDefinitionExecResultUtil {
|
|||
} else {
|
||||
apiResult.setId(reportId);
|
||||
}
|
||||
apiResult.setReportType(ReportTypeConstants.API_INDEPENDENT.name());
|
||||
apiResult.setCreateTime(System.currentTimeMillis());
|
||||
apiResult.setStartTime(System.currentTimeMillis());
|
||||
apiResult.setEndTime(System.currentTimeMillis());
|
||||
|
|
|
@ -14,6 +14,7 @@ import io.metersphere.base.mapper.*;
|
|||
import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
|
@ -118,6 +119,16 @@ public class ApiScenarioReportService {
|
|||
}
|
||||
|
||||
public APIScenarioReportResult get(String reportId) {
|
||||
ApiDefinitionExecResult result = definitionExecResultMapper.selectByPrimaryKey(reportId);
|
||||
if (result != null) {
|
||||
APIScenarioReportResult reportResult = new APIScenarioReportResult();
|
||||
BeanUtils.copyBean(reportResult, result);
|
||||
reportResult.setReportVersion(2);
|
||||
reportResult.setTestId(reportId);
|
||||
ApiScenarioReportDTO dto = apiScenarioReportStructureService.apiIntegratedReport(reportId);
|
||||
reportResult.setContent(JSON.toJSONString(dto));
|
||||
return reportResult;
|
||||
}
|
||||
APIScenarioReportResult reportResult = extApiScenarioReportMapper.get(reportId);
|
||||
if (reportResult != null) {
|
||||
if (reportResult.getReportVersion() != null && reportResult.getReportVersion() > 1) {
|
||||
|
@ -323,27 +334,28 @@ public class ApiScenarioReportService {
|
|||
}
|
||||
|
||||
public void margeReport(String reportId, String runMode) {
|
||||
ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(reportId);
|
||||
if (report != null) {
|
||||
// 更新场景状态
|
||||
if (StringUtils.equalsIgnoreCase(runMode, ApiRunMode.DEFINITION.name())) {
|
||||
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
||||
execResultExample.createCriteria().andIntegratedReportIdEqualTo(reportId).andStatusEqualTo("Error");
|
||||
long size = definitionExecResultMapper.countByExample(execResultExample);
|
||||
report.setStatus(size > 0 ? ScenarioStatus.Error.name() : ScenarioStatus.Success.name());
|
||||
} else {
|
||||
// 更新场景状态
|
||||
if (StringUtils.equalsIgnoreCase(runMode, ApiRunMode.DEFINITION.name())) {
|
||||
ApiDefinitionExecResult result = definitionExecResultMapper.selectByPrimaryKey(reportId);
|
||||
ApiDefinitionExecResultExample execResultExample = new ApiDefinitionExecResultExample();
|
||||
execResultExample.createCriteria().andIntegratedReportIdEqualTo(reportId).andStatusEqualTo("Error");
|
||||
long size = definitionExecResultMapper.countByExample(execResultExample);
|
||||
result.setStatus(size > 0 ? ScenarioStatus.Error.name() : ScenarioStatus.Success.name());
|
||||
definitionExecResultMapper.updateByPrimaryKeySelective(result);
|
||||
} else {
|
||||
ApiScenarioReport report = apiScenarioReportMapper.selectByPrimaryKey(reportId);
|
||||
if (report != null) {
|
||||
ApiScenarioReportResultExample example = new ApiScenarioReportResultExample();
|
||||
example.createCriteria().andReportIdEqualTo(reportId).andStatusEqualTo(ScenarioStatus.Error.name());
|
||||
long size = apiScenarioReportResultMapper.countByExample(example);
|
||||
report.setStatus(size > 0 ? ScenarioStatus.Error.name() : ScenarioStatus.Success.name());
|
||||
report.setEndTime(System.currentTimeMillis());
|
||||
// 更新报告
|
||||
apiScenarioReportMapper.updateByPrimaryKey(report);
|
||||
}
|
||||
// 更新控制台信息
|
||||
apiScenarioReportStructureService.update(reportId, FixedCapacityUtils.getJmeterLogger(reportId));
|
||||
|
||||
report.setEndTime(System.currentTimeMillis());
|
||||
// 更新报告
|
||||
apiScenarioReportMapper.updateByPrimaryKey(report);
|
||||
}
|
||||
// 更新控制台信息
|
||||
apiScenarioReportStructureService.update(reportId, FixedCapacityUtils.getJmeterLogger(reportId));
|
||||
}
|
||||
|
||||
public ApiScenarioReport updateScenario(List<ApiScenarioReportResult> requestResults, ResultDTO dto) {
|
||||
|
|
|
@ -312,7 +312,7 @@ public class ApiScenarioReportStructureService {
|
|||
return resultVos;
|
||||
}
|
||||
|
||||
private ApiScenarioReportDTO apiIntegratedReport(String reportId) {
|
||||
public ApiScenarioReportDTO apiIntegratedReport(String reportId) {
|
||||
List<StepTreeDTO> stepList = new LinkedList<>();
|
||||
List<ApiDefinitionExecResultVo> reportResults = this.formatApiReport(reportId, stepList);
|
||||
ApiScenarioReportDTO reportDTO = new ApiScenarioReportDTO();
|
||||
|
|
|
@ -36,9 +36,9 @@ public class ApiDefinitionExecResult implements Serializable {
|
|||
|
||||
private String integratedReportId;
|
||||
|
||||
private String content;
|
||||
|
||||
private String reportType;
|
||||
|
||||
private String content;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -1123,6 +1123,76 @@ public class ApiDefinitionExecResultExample {
|
|||
addCriterion("integrated_report_id not between", value1, value2, "integratedReportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeIsNull() {
|
||||
addCriterion("report_type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeIsNotNull() {
|
||||
addCriterion("report_type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeEqualTo(String value) {
|
||||
addCriterion("report_type =", value, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeNotEqualTo(String value) {
|
||||
addCriterion("report_type <>", value, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeGreaterThan(String value) {
|
||||
addCriterion("report_type >", value, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("report_type >=", value, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeLessThan(String value) {
|
||||
addCriterion("report_type <", value, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("report_type <=", value, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeLike(String value) {
|
||||
addCriterion("report_type like", value, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeNotLike(String value) {
|
||||
addCriterion("report_type not like", value, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeIn(List<String> values) {
|
||||
addCriterion("report_type in", values, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeNotIn(List<String> values) {
|
||||
addCriterion("report_type not in", values, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeBetween(String value1, String value2) {
|
||||
addCriterion("report_type between", value1, value2, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("report_type not between", value1, value2, "reportType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="integrated_report_id" jdbcType="VARCHAR" property="integratedReportId" />
|
||||
<result column="report_type" jdbcType="VARCHAR" property="reportType" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionExecResult">
|
||||
<result column="content" jdbcType="LONGVARCHAR" property="content" />
|
||||
|
@ -81,7 +82,8 @@
|
|||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`, resource_id, `status`, user_id, start_time, end_time, create_time, `type`,
|
||||
actuator, trigger_mode, error_code, version_id, project_id, integrated_report_id
|
||||
actuator, trigger_mode, error_code, version_id, project_id, integrated_report_id,
|
||||
report_type
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
content
|
||||
|
@ -140,13 +142,13 @@
|
|||
end_time, create_time, `type`,
|
||||
actuator, trigger_mode, error_code,
|
||||
version_id, project_id, integrated_report_id,
|
||||
content)
|
||||
report_type, content)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
|
||||
#{endTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR},
|
||||
#{actuator,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR}, #{errorCode,jdbcType=VARCHAR},
|
||||
#{versionId,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{integratedReportId,jdbcType=VARCHAR},
|
||||
#{content,jdbcType=LONGVARCHAR})
|
||||
#{reportType,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionExecResult">
|
||||
insert into api_definition_exec_result
|
||||
|
@ -196,6 +198,9 @@
|
|||
<if test="integratedReportId != null">
|
||||
integrated_report_id,
|
||||
</if>
|
||||
<if test="reportType != null">
|
||||
report_type,
|
||||
</if>
|
||||
<if test="content != null">
|
||||
content,
|
||||
</if>
|
||||
|
@ -246,6 +251,9 @@
|
|||
<if test="integratedReportId != null">
|
||||
#{integratedReportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="reportType != null">
|
||||
#{reportType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="content != null">
|
||||
#{content,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -305,6 +313,9 @@
|
|||
<if test="record.integratedReportId != null">
|
||||
integrated_report_id = #{record.integratedReportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.reportType != null">
|
||||
report_type = #{record.reportType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.content != null">
|
||||
content = #{record.content,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -330,6 +341,7 @@
|
|||
version_id = #{record.versionId,jdbcType=VARCHAR},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
integrated_report_id = #{record.integratedReportId,jdbcType=VARCHAR},
|
||||
report_type = #{record.reportType,jdbcType=VARCHAR},
|
||||
content = #{record.content,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -351,7 +363,8 @@
|
|||
error_code = #{record.errorCode,jdbcType=VARCHAR},
|
||||
version_id = #{record.versionId,jdbcType=VARCHAR},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
integrated_report_id = #{record.integratedReportId,jdbcType=VARCHAR}
|
||||
integrated_report_id = #{record.integratedReportId,jdbcType=VARCHAR},
|
||||
report_type = #{record.reportType,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -401,6 +414,9 @@
|
|||
<if test="integratedReportId != null">
|
||||
integrated_report_id = #{integratedReportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="reportType != null">
|
||||
report_type = #{reportType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="content != null">
|
||||
content = #{content,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -423,6 +439,7 @@
|
|||
version_id = #{versionId,jdbcType=VARCHAR},
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
integrated_report_id = #{integratedReportId,jdbcType=VARCHAR},
|
||||
report_type = #{reportType,jdbcType=VARCHAR},
|
||||
content = #{content,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -441,7 +458,8 @@
|
|||
error_code = #{errorCode,jdbcType=VARCHAR},
|
||||
version_id = #{versionId,jdbcType=VARCHAR},
|
||||
project_id = #{projectId,jdbcType=VARCHAR},
|
||||
integrated_report_id = #{integratedReportId,jdbcType=VARCHAR}
|
||||
integrated_report_id = #{integratedReportId,jdbcType=VARCHAR},
|
||||
report_type = #{reportType,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -8,7 +8,7 @@ public class ExtApiDefinitionExecResultProvider {
|
|||
public String insertListSql(List<ApiDefinitionExecResult> list) {
|
||||
StringBuffer sqlList = new StringBuffer();
|
||||
sqlList.append("insert into api_definition_exec_result (id, `name`, resource_id, `status`, user_id, start_time, end_time," +
|
||||
" create_time, `type`, actuator, trigger_mode, version_id, error_code,project_id,integrated_report_id, content) values ");
|
||||
" create_time, `type`, actuator, trigger_mode, version_id, error_code,project_id,integrated_report_id,report_type, content) values ");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ApiDefinitionExecResult result = list.get(i);
|
||||
sqlList.append(" (")
|
||||
|
@ -43,6 +43,8 @@ public class ExtApiDefinitionExecResultProvider {
|
|||
.append("','")
|
||||
.append(result.getIntegratedReportId())
|
||||
.append("','")
|
||||
.append(result.getReportType())
|
||||
.append("','")
|
||||
.append(result.getContent())
|
||||
.append("'")
|
||||
.append(")");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<select id="getTasks" resultType="io.metersphere.task.dto.TaskCenterDTO"
|
||||
parameterType="java.lang.String">
|
||||
SELECT tt.* FROM (
|
||||
(select t.id,if(t.scenario_id like "[\"%\"]", t.name,t.scenario_name) as name ,'SCENARIO' as executionModule, ifnull(t2.name,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, t.trigger_mode as triggerMode ,t.status as executionStatus
|
||||
(select t.id,if(t.scenario_id like "[\"%\"]", t.name,t.scenario_name) as name ,'SCENARIO' as executionModule,t.report_type, ifnull(t2.name,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, t.trigger_mode as triggerMode ,t.status as executionStatus
|
||||
from api_scenario_report t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.actuator = t2.id
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and t.execute_type !='Debug' and t.execute_type !='Marge' and t.project_id= #{request.projectId}
|
||||
<if test="request.triggerMode != null and request.triggerMode != ''">
|
||||
|
@ -18,12 +18,9 @@
|
|||
</if>
|
||||
)
|
||||
UNION ALL
|
||||
(select t.id,t.name,'API' as executionModule, ifnull(t2.name,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, ifnull(t.trigger_mode,'MANUAL') as triggerMode ,ifnull(t.status,'Saved') as executionStatus
|
||||
(select t.id,t.name,'API' as executionModule, t.report_type, ifnull(t2.name,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, ifnull(t.trigger_mode,'MANUAL') as triggerMode ,ifnull(t.status,'Saved') as executionStatus
|
||||
from api_definition_exec_result t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.actuator = t2.id
|
||||
left join api_definition t3 on t.resource_id = t3.id left join api_test_case t4 on t4.id = t.resource_id
|
||||
left join test_plan_api_case t5 on t.resource_id = t5.id left join test_plan t6 on t5.test_plan_id = t6.id
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and
|
||||
(t3.project_id =#{request.projectId} OR t4.project_id =#{request.projectId} OR t6.project_id = #{request.projectId})
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and t.project_id =#{request.projectId}
|
||||
<if test="request.triggerMode != null and request.triggerMode != ''">
|
||||
and t.trigger_mode = #{request.triggerMode}
|
||||
</if>
|
||||
|
@ -36,7 +33,7 @@
|
|||
and (t.integrated_report_id is null or t.integrated_report_id = 'null')
|
||||
)
|
||||
UNION ALL
|
||||
(select t.id,t.name,'PERFORMANCE' as executionModule, ifnull(t2.name,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, t.trigger_mode as triggerMode ,t.`status` as executionStatus
|
||||
(select t.id,t.name,'PERFORMANCE' as executionModule,'PERFORMANCE' as report_type, ifnull(t2.name,'LOCAL') as actuator, t1.`name` as executor,t.create_time as executionTime, t.trigger_mode as triggerMode ,t.`status` as executionStatus
|
||||
from load_test_report t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.test_resource_pool_id = t2.id
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and t.project_id= #{request.projectId}
|
||||
<if test="request.triggerMode != null and request.triggerMode != ''">
|
||||
|
@ -78,9 +75,10 @@
|
|||
UNION ALL
|
||||
(select t.id,t.create_time as executionTime
|
||||
from api_definition_exec_result t left join `user` t1 ON t.user_id = t1.id left join test_resource_pool t2 on t.actuator = t2.id
|
||||
left join api_definition t3 on t.resource_id = t3.id left join api_test_case t4 on t4.id = t.resource_id
|
||||
left join test_plan_api_case t5 on t.resource_id = t5.id left join test_plan t6 on t5.test_plan_id = t6.id
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now()) and (t.integrated_report_id is null or t.integrated_report_id='null') and (t3.project_id =#{request.projectId} OR t4.project_id =#{request.projectId} OR t6.project_id = #{request.projectId}) and t.status not in ("saved","completed","success","error","STOP")
|
||||
where to_days(FROM_UNIXTIME(t.create_time/1000))= to_days(now())
|
||||
and (t.integrated_report_id is null or t.integrated_report_id='null')
|
||||
and t.project_id =#{request.projectId}
|
||||
and t.status not in ("saved","completed","success","error","STOP")
|
||||
)
|
||||
UNION ALL
|
||||
(select t.id,t.create_time as executionTime
|
||||
|
|
|
@ -34,4 +34,6 @@ public class TaskCenterDTO {
|
|||
* 执行模块/场景/接口/性能
|
||||
*/
|
||||
private String executionModule;
|
||||
|
||||
private String reportType;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
<!-- <ignoreColumn column="clean_load_report_expr"/>-->
|
||||
<!-- <ignoreColumn column="repeatable"/>-->
|
||||
<!-- </table>-->
|
||||
<table tableName="api_test_environment">
|
||||
<table tableName="api_definition_exec_result">
|
||||
|
||||
</table>
|
||||
<!--<table tableName="enterprise_test_report_send_record"/>-->
|
||||
|
|
|
@ -35,11 +35,11 @@
|
|||
<el-card style="float: left;width: 850px" v-if="size > 550 ">
|
||||
<div class="ms-task-opt-btn" @click="packUp">{{ $t('commons.task_close') }}</div>
|
||||
<!-- 接口用例结果 -->
|
||||
<ms-request-result-tail :response="response" ref="debugResult" v-if="reportType === 'API'"/>
|
||||
<ms-request-result-tail :response="response" ref="debugResult" v-if="executionModule === 'API' && reportType !=='API_INTEGRATED'"/>
|
||||
|
||||
<ms-api-report-detail :showCancelButton="false" :reportId="reportId" v-if="reportType === 'SCENARIO'"/>
|
||||
<ms-api-report-detail :showCancelButton="false" :reportId="reportId" v-if="executionModule === 'SCENARIO'|| reportType ==='API_INTEGRATED'"/>
|
||||
|
||||
<performance-report-view :perReportId="reportId" v-if="reportType === 'PERFORMANCE'"/>
|
||||
<performance-report-view :perReportId="reportId" v-if="executionModule === 'PERFORMANCE'"/>
|
||||
</el-card>
|
||||
|
||||
<el-card style="width: 550px;float: right" v-loading="loading">
|
||||
|
@ -196,6 +196,7 @@ export default {
|
|||
websocket: Object,
|
||||
size: 550,
|
||||
reportId: "",
|
||||
executionModule: "",
|
||||
reportType: "",
|
||||
};
|
||||
},
|
||||
|
@ -350,8 +351,9 @@ export default {
|
|||
if (status === 'saved' || status === 'completed' || status === 'success' || status === 'error' || status === 'errorreportresult') {
|
||||
this.size = 1400;
|
||||
this.reportId = row.id;
|
||||
this.reportType = row.executionModule;
|
||||
if (row.executionModule === "API") {
|
||||
this.executionModule = row.executionModule;
|
||||
this.reportType = row.reportType;
|
||||
if (row.executionModule === "API" && row.reportType !== 'API_INTEGRATED') {
|
||||
this.getExecResult(row.id);
|
||||
}
|
||||
} else if (status === 'stop') {
|
||||
|
|
Loading…
Reference in New Issue