fix(测试跟踪): 优化测试计划报告查看速度
--bug=1019086 --user=宋天阳 #18478 测试计划关联用例多时(500多个场景用例),查看报告耗时较长(30-60s),建议优化 https://www.tapd.cn/55049933/s/1283179
This commit is contained in:
parent
fae6dee227
commit
0f00ab13fa
|
@ -51,5 +51,7 @@ public class TestPlanReportContentWithBLOBs extends TestPlanReportContent implem
|
||||||
|
|
||||||
private String unExecuteScenarios;
|
private String unExecuteScenarios;
|
||||||
|
|
||||||
|
private String apiBaseCount;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
|
@ -33,6 +33,7 @@
|
||||||
<result column="error_report_scenarios" jdbcType="LONGVARCHAR" property="errorReportScenarios" />
|
<result column="error_report_scenarios" jdbcType="LONGVARCHAR" property="errorReportScenarios" />
|
||||||
<result column="un_execute_cases" jdbcType="LONGVARCHAR" property="unExecuteCases" />
|
<result column="un_execute_cases" jdbcType="LONGVARCHAR" property="unExecuteCases" />
|
||||||
<result column="un_execute_scenarios" jdbcType="LONGVARCHAR" property="unExecuteScenarios" />
|
<result column="un_execute_scenarios" jdbcType="LONGVARCHAR" property="unExecuteScenarios" />
|
||||||
|
<result column="api_base_count" jdbcType="LONGVARCHAR" property="apiBaseCount" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Example_Where_Clause">
|
<sql id="Example_Where_Clause">
|
||||||
<where>
|
<where>
|
||||||
|
@ -101,7 +102,7 @@
|
||||||
issue_list, api_all_cases, api_failure_cases, scenario_all_cases, scenario_failure_cases,
|
issue_list, api_all_cases, api_failure_cases, scenario_all_cases, scenario_failure_cases,
|
||||||
load_all_Cases, load_failure_cases, plan_scenario_report_struct, plan_api_case_report_struct,
|
load_all_Cases, load_failure_cases, plan_scenario_report_struct, plan_api_case_report_struct,
|
||||||
plan_load_case_report_struct, error_report_cases, error_report_scenarios, un_execute_cases,
|
plan_load_case_report_struct, error_report_cases, error_report_scenarios, un_execute_cases,
|
||||||
un_execute_scenarios
|
un_execute_scenarios, api_base_count
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanReportContentExample" resultMap="ResultMapWithBLOBs">
|
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanReportContentExample" resultMap="ResultMapWithBLOBs">
|
||||||
select
|
select
|
||||||
|
@ -163,7 +164,8 @@
|
||||||
plan_scenario_report_struct, plan_api_case_report_struct,
|
plan_scenario_report_struct, plan_api_case_report_struct,
|
||||||
plan_load_case_report_struct, error_report_cases,
|
plan_load_case_report_struct, error_report_cases,
|
||||||
error_report_scenarios, un_execute_cases,
|
error_report_scenarios, un_execute_cases,
|
||||||
un_execute_scenarios)
|
un_execute_scenarios, api_base_count
|
||||||
|
)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
|
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
|
||||||
#{caseCount,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{executeRate,jdbcType=DOUBLE},
|
#{caseCount,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{executeRate,jdbcType=DOUBLE},
|
||||||
#{passRate,jdbcType=DOUBLE}, #{isThirdPartIssue,jdbcType=BIT}, #{config,jdbcType=LONGVARCHAR},
|
#{passRate,jdbcType=DOUBLE}, #{isThirdPartIssue,jdbcType=BIT}, #{config,jdbcType=LONGVARCHAR},
|
||||||
|
@ -175,7 +177,8 @@
|
||||||
#{planScenarioReportStruct,jdbcType=LONGVARCHAR}, #{planApiCaseReportStruct,jdbcType=LONGVARCHAR},
|
#{planScenarioReportStruct,jdbcType=LONGVARCHAR}, #{planApiCaseReportStruct,jdbcType=LONGVARCHAR},
|
||||||
#{planLoadCaseReportStruct,jdbcType=LONGVARCHAR}, #{errorReportCases,jdbcType=LONGVARCHAR},
|
#{planLoadCaseReportStruct,jdbcType=LONGVARCHAR}, #{errorReportCases,jdbcType=LONGVARCHAR},
|
||||||
#{errorReportScenarios,jdbcType=LONGVARCHAR}, #{unExecuteCases,jdbcType=LONGVARCHAR},
|
#{errorReportScenarios,jdbcType=LONGVARCHAR}, #{unExecuteCases,jdbcType=LONGVARCHAR},
|
||||||
#{unExecuteScenarios,jdbcType=LONGVARCHAR})
|
#{unExecuteScenarios,jdbcType=LONGVARCHAR}, #{apiBaseCount,jdbcType=LONGVARCHAR}
|
||||||
|
)
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanReportContentWithBLOBs">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanReportContentWithBLOBs">
|
||||||
insert into test_plan_report_content
|
insert into test_plan_report_content
|
||||||
|
@ -267,6 +270,9 @@
|
||||||
<if test="unExecuteScenarios != null">
|
<if test="unExecuteScenarios != null">
|
||||||
un_execute_scenarios,
|
un_execute_scenarios,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="apiBaseCount != null">
|
||||||
|
api_base_count,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
|
@ -356,6 +362,9 @@
|
||||||
<if test="unExecuteScenarios != null">
|
<if test="unExecuteScenarios != null">
|
||||||
#{unExecuteScenarios,jdbcType=LONGVARCHAR},
|
#{unExecuteScenarios,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="apiBaseCount != null">
|
||||||
|
#{apiBaseCount,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanReportContentExample" resultType="java.lang.Long">
|
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanReportContentExample" resultType="java.lang.Long">
|
||||||
|
@ -454,6 +463,9 @@
|
||||||
<if test="record.unExecuteScenarios != null">
|
<if test="record.unExecuteScenarios != null">
|
||||||
un_execute_scenarios = #{record.unExecuteScenarios,jdbcType=LONGVARCHAR},
|
un_execute_scenarios = #{record.unExecuteScenarios,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.apiBaseCount != null">
|
||||||
|
api_base_count = #{record.apiBaseCount,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
|
@ -489,7 +501,8 @@
|
||||||
error_report_cases = #{record.errorReportCases,jdbcType=LONGVARCHAR},
|
error_report_cases = #{record.errorReportCases,jdbcType=LONGVARCHAR},
|
||||||
error_report_scenarios = #{record.errorReportScenarios,jdbcType=LONGVARCHAR},
|
error_report_scenarios = #{record.errorReportScenarios,jdbcType=LONGVARCHAR},
|
||||||
un_execute_cases = #{record.unExecuteCases,jdbcType=LONGVARCHAR},
|
un_execute_cases = #{record.unExecuteCases,jdbcType=LONGVARCHAR},
|
||||||
un_execute_scenarios = #{record.unExecuteScenarios,jdbcType=LONGVARCHAR}
|
un_execute_scenarios = #{record.unExecuteScenarios,jdbcType=LONGVARCHAR},
|
||||||
|
api_base_count = #{record.apiBaseCount,jdbcType=LONGVARCHAR}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -595,6 +608,9 @@
|
||||||
<if test="unExecuteScenarios != null">
|
<if test="unExecuteScenarios != null">
|
||||||
un_execute_scenarios = #{unExecuteScenarios,jdbcType=LONGVARCHAR},
|
un_execute_scenarios = #{unExecuteScenarios,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="apiBaseCount != null">
|
||||||
|
api_base_count = #{apiBaseCount,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
|
@ -627,7 +643,8 @@
|
||||||
error_report_cases = #{errorReportCases,jdbcType=LONGVARCHAR},
|
error_report_cases = #{errorReportCases,jdbcType=LONGVARCHAR},
|
||||||
error_report_scenarios = #{errorReportScenarios,jdbcType=LONGVARCHAR},
|
error_report_scenarios = #{errorReportScenarios,jdbcType=LONGVARCHAR},
|
||||||
un_execute_cases = #{unExecuteCases,jdbcType=LONGVARCHAR},
|
un_execute_cases = #{unExecuteCases,jdbcType=LONGVARCHAR},
|
||||||
un_execute_scenarios = #{unExecuteScenarios,jdbcType=LONGVARCHAR}
|
un_execute_scenarios = #{unExecuteScenarios,jdbcType=LONGVARCHAR},
|
||||||
|
api_base_count = #{apiBaseCount,jdbcType=LONGVARCHAR}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlanReportContent">
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlanReportContent">
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package io.metersphere.track.dto;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class TestPlanReportBuildResultDTO {
|
||||||
|
private TestPlanSimpleReportDTO testPlanSimpleReportDTO;
|
||||||
|
/**
|
||||||
|
* 判断testPlanReportContent中,APIBaseInfo字段是否改变。
|
||||||
|
* 如果改变过,则需要更新testPlanReportContent数据
|
||||||
|
*/
|
||||||
|
private boolean apiBaseInfoChanged = false;
|
||||||
|
}
|
|
@ -415,16 +415,33 @@ public class TestPlanReportService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestPlanReportContentWithBLOBs updateReport(TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs reportContent) {
|
public TestPlanReportContentWithBLOBs updateReport(TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs reportContent) {
|
||||||
if (testPlanReport == null) {
|
if (testPlanReport == null || reportContent == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
TestPlanService testPlanService = CommonBeanFactory.getBean(TestPlanService.class);
|
TestPlanService testPlanService = CommonBeanFactory.getBean(TestPlanService.class);
|
||||||
TestPlanSimpleReportDTO reportDTO = testPlanService.buildPlanReport(testPlanReport, reportContent);
|
TestPlanReportBuildResultDTO reportBuildResult = testPlanService.buildPlanReport(testPlanReport, reportContent);
|
||||||
|
TestPlanSimpleReportDTO reportDTO = reportBuildResult.getTestPlanSimpleReportDTO();
|
||||||
reportDTO.setStartTime(testPlanReport.getStartTime());
|
reportDTO.setStartTime(testPlanReport.getStartTime());
|
||||||
reportContent = parseReportDaoToReportContent(testPlanReport.getStatus(), reportDTO, reportContent);
|
reportContent = parseReportDaoToReportContent(testPlanReport.getStatus(), reportDTO, reportContent);
|
||||||
|
this.updatePassRateAndApiBaseInfoFromReportContent(testPlanReport.getStatus(), reportDTO, reportContent, reportBuildResult.isApiBaseInfoChanged());
|
||||||
return reportContent;
|
return reportContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updatePassRateAndApiBaseInfoFromReportContent(String status, TestPlanSimpleReportDTO reportDTO, TestPlanReportContentWithBLOBs reportContent, boolean apiBaseInfoChanged) {
|
||||||
|
// 如果报告已结束,则更新测试计划报告通过率字段 passRate
|
||||||
|
if (!StringUtils.equalsIgnoreCase(status, "running") && (Double.compare(reportContent.getPassRate(), reportDTO.getPassRate()) != 0 || apiBaseInfoChanged)) {
|
||||||
|
TestPlanReportContentExample contentExample = new TestPlanReportContentExample();
|
||||||
|
contentExample.createCriteria().andTestPlanReportIdEqualTo(reportContent.getTestPlanReportId());
|
||||||
|
TestPlanReportContentWithBLOBs content = new TestPlanReportContentWithBLOBs();
|
||||||
|
content.setPassRate(reportDTO.getPassRate());
|
||||||
|
if (apiBaseInfoChanged) {
|
||||||
|
content.setApiBaseCount(reportContent.getApiBaseCount());
|
||||||
|
}
|
||||||
|
testPlanReportContentMapper.updateByExampleSelective(content, contentExample);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public TestPlanReport finishedTestPlanReport(String testPlanReportId, String status) {
|
public TestPlanReport finishedTestPlanReport(String testPlanReportId, String status) {
|
||||||
TestPlanReport testPlanReport = this.getTestPlanReport(testPlanReportId);
|
TestPlanReport testPlanReport = this.getTestPlanReport(testPlanReportId);
|
||||||
if (testPlanReport != null && StringUtils.equalsIgnoreCase(testPlanReport.getStatus(), "stopped")) {
|
if (testPlanReport != null && StringUtils.equalsIgnoreCase(testPlanReport.getStatus(), "stopped")) {
|
||||||
|
@ -457,12 +474,7 @@ public class TestPlanReportService {
|
||||||
if (CollectionUtils.isNotEmpty(contents)) {
|
if (CollectionUtils.isNotEmpty(contents)) {
|
||||||
content = contents.get(0);
|
content = contents.get(0);
|
||||||
}
|
}
|
||||||
if (content != null) {
|
|
||||||
//更新content表对结束日期
|
|
||||||
content.setStartTime(testPlanReport.getStartTime());
|
|
||||||
content.setEndTime(endTime);
|
|
||||||
testPlanReportContentMapper.updateByExampleSelective(content, contentExample);
|
|
||||||
}
|
|
||||||
//计算测试计划状态
|
//计算测试计划状态
|
||||||
if (StringUtils.equalsIgnoreCase(status, TestPlanReportStatus.COMPLETED.name())) {
|
if (StringUtils.equalsIgnoreCase(status, TestPlanReportStatus.COMPLETED.name())) {
|
||||||
testPlanReport.setStatus(TestPlanReportStatus.SUCCESS.name());
|
testPlanReport.setStatus(TestPlanReportStatus.SUCCESS.name());
|
||||||
|
@ -474,6 +486,14 @@ public class TestPlanReportService {
|
||||||
testPlanReport.setIsScenarioExecuting(false);
|
testPlanReport.setIsScenarioExecuting(false);
|
||||||
testPlanReport.setIsPerformanceExecuting(false);
|
testPlanReport.setIsPerformanceExecuting(false);
|
||||||
|
|
||||||
|
if (content != null) {
|
||||||
|
//更新content表对结束日期,并计算报表信息
|
||||||
|
content.setStartTime(testPlanReport.getStartTime());
|
||||||
|
content.setEndTime(endTime);
|
||||||
|
this.initTestPlanReportBaseCount(testPlanReport,content);
|
||||||
|
testPlanReportContentMapper.updateByExampleSelective(content, contentExample);
|
||||||
|
}
|
||||||
|
|
||||||
TestPlanExecutionQueueExample testPlanExecutionQueueExample = new TestPlanExecutionQueueExample();
|
TestPlanExecutionQueueExample testPlanExecutionQueueExample = new TestPlanExecutionQueueExample();
|
||||||
testPlanExecutionQueueExample.createCriteria().andReportIdEqualTo(testPlanReportId);
|
testPlanExecutionQueueExample.createCriteria().andReportIdEqualTo(testPlanReportId);
|
||||||
List<TestPlanExecutionQueue> planExecutionQueues = testPlanExecutionQueueMapper.selectByExample(testPlanExecutionQueueExample);
|
List<TestPlanExecutionQueue> planExecutionQueues = testPlanExecutionQueueMapper.selectByExample(testPlanExecutionQueueExample);
|
||||||
|
@ -507,6 +527,13 @@ public class TestPlanReportService {
|
||||||
return testPlanReport;
|
return testPlanReport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initTestPlanReportBaseCount(TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs reportContent) {
|
||||||
|
if(testPlanReport != null && reportContent != null){
|
||||||
|
TestPlanReportBuildResultDTO reportBuildResultDTO = testPlanService.buildPlanReport(testPlanReport, reportContent);
|
||||||
|
reportContent.setApiBaseCount(JSONObject.toJSONString(reportBuildResultDTO.getTestPlanSimpleReportDTO()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param planReportId 测试计划报告ID
|
* @param planReportId 测试计划报告ID
|
||||||
* @param resourceRunMode 资源的运行模式,triggerMode非Scedule可以为null
|
* @param resourceRunMode 资源的运行模式,triggerMode非Scedule可以为null
|
||||||
|
@ -621,14 +648,6 @@ public class TestPlanReportService {
|
||||||
testPlanReportContentWithBLOBs.setUnExecuteScenarios(JSONObject.toJSONString(reportDTO.getUnExecuteScenarios()));
|
testPlanReportContentWithBLOBs.setUnExecuteScenarios(JSONObject.toJSONString(reportDTO.getUnExecuteScenarios()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果报告已结束,则更新测试计划报告通过率字段 passRate
|
|
||||||
if (!StringUtils.equalsIgnoreCase(testPlanReportStatus, "running")) {
|
|
||||||
TestPlanReportContentExample contentExample = new TestPlanReportContentExample();
|
|
||||||
contentExample.createCriteria().andTestPlanReportIdEqualTo(testPlanReportId);
|
|
||||||
TestPlanReportContentWithBLOBs content = new TestPlanReportContentWithBLOBs();
|
|
||||||
content.setPassRate(reportDTO.getPassRate());
|
|
||||||
testPlanReportContentMapper.updateByExampleSelective(content, contentExample);
|
|
||||||
}
|
|
||||||
return testPlanReportContentWithBLOBs;
|
return testPlanReportContentWithBLOBs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1735,6 +1735,7 @@ public class TestPlanService {
|
||||||
|
|
||||||
public void buildLoadReport(TestPlanSimpleReportDTO report, JSONObject config, Map<String, String> loadCaseReportMap, boolean saveResponse) {
|
public void buildLoadReport(TestPlanSimpleReportDTO report, JSONObject config, Map<String, String> loadCaseReportMap, boolean saveResponse) {
|
||||||
if (MapUtils.isEmpty(loadCaseReportMap)) {
|
if (MapUtils.isEmpty(loadCaseReportMap)) {
|
||||||
|
report.setLoadAllCases(new ArrayList<>());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (checkReportConfig(config, "load")) {
|
if (checkReportConfig(config, "load")) {
|
||||||
|
@ -1759,7 +1760,13 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestPlanSimpleReportDTO buildPlanReport(TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs testPlanReportContentWithBLOBs) {
|
/**
|
||||||
|
* @param testPlanReport 测试计划报告
|
||||||
|
* @param testPlanReportContentWithBLOBs 测试计划报告内容
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TestPlanReportBuildResultDTO buildPlanReport(TestPlanReport testPlanReport, TestPlanReportContentWithBLOBs testPlanReportContentWithBLOBs) {
|
||||||
|
TestPlanReportBuildResultDTO returnDTO = new TestPlanReportBuildResultDTO();
|
||||||
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId());
|
TestPlanWithBLOBs testPlan = testPlanMapper.selectByPrimaryKey(testPlanReport.getTestPlanId());
|
||||||
if (testPlan != null) {
|
if (testPlan != null) {
|
||||||
String reportConfig = testPlan.getReportConfig();
|
String reportConfig = testPlan.getReportConfig();
|
||||||
|
@ -1768,13 +1775,44 @@ public class TestPlanService {
|
||||||
config = JSONObject.parseObject(reportConfig);
|
config = JSONObject.parseObject(reportConfig);
|
||||||
}
|
}
|
||||||
TestPlanExecuteReportDTO testPlanExecuteReportDTO = testPlanReportService.genTestPlanExecuteReportDTOByTestPlanReportContent(testPlanReportContentWithBLOBs);
|
TestPlanExecuteReportDTO testPlanExecuteReportDTO = testPlanReportService.genTestPlanExecuteReportDTOByTestPlanReportContent(testPlanReportContentWithBLOBs);
|
||||||
TestPlanSimpleReportDTO report = getReport(testPlanReport.getTestPlanId(), testPlanExecuteReportDTO);
|
TestPlanSimpleReportDTO report = null;
|
||||||
buildFunctionalReport(report, config, testPlanReport.getTestPlanId());
|
boolean apiBaseInfoChanged = false;
|
||||||
buildApiReport(report, config, testPlanExecuteReportDTO);
|
if (StringUtils.isEmpty(testPlanReportContentWithBLOBs.getApiBaseCount())) {
|
||||||
buildLoadReport(report, config, testPlanExecuteReportDTO.getTestPlanLoadCaseIdAndReportIdMap(), false);
|
report = getReport(testPlanReport.getTestPlanId(), testPlanExecuteReportDTO);
|
||||||
return report;
|
apiBaseInfoChanged = true;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
try {
|
||||||
|
report = JSONObject.parseObject(testPlanReportContentWithBLOBs.getApiBaseCount(), TestPlanSimpleReportDTO.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.info("解析接口统计数据出错!数据:" + testPlanReportContentWithBLOBs.getApiBaseCount(), e);
|
||||||
|
}
|
||||||
|
if (report == null) {
|
||||||
|
report = getReport(testPlanReport.getTestPlanId(), testPlanExecuteReportDTO);
|
||||||
|
apiBaseInfoChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(report.getFunctionAllCases() == null || report.getIssueList() == null){
|
||||||
|
buildFunctionalReport(report, config, testPlanReport.getTestPlanId());
|
||||||
|
apiBaseInfoChanged = true;
|
||||||
|
}
|
||||||
|
if(report.getApiAllCases() == null && report.getScenarioAllCases() == null){
|
||||||
|
buildApiReport(report, config, testPlanExecuteReportDTO);
|
||||||
|
apiBaseInfoChanged = true;
|
||||||
|
}
|
||||||
|
if(report.getLoadAllCases() == null){
|
||||||
|
buildLoadReport(report, config, testPlanExecuteReportDTO.getTestPlanLoadCaseIdAndReportIdMap(), false);
|
||||||
|
apiBaseInfoChanged = true;
|
||||||
|
}
|
||||||
|
returnDTO.setTestPlanSimpleReportDTO(report);
|
||||||
|
|
||||||
|
if(apiBaseInfoChanged){
|
||||||
|
testPlanReportContentWithBLOBs.setApiBaseCount(JSONObject.toJSONString(report));
|
||||||
|
returnDTO.setApiBaseInfoChanged(true);
|
||||||
|
}
|
||||||
|
return returnDTO;
|
||||||
|
} else {
|
||||||
|
returnDTO.setTestPlanSimpleReportDTO(new TestPlanSimpleReportDTO());
|
||||||
|
return returnDTO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,6 @@ ALTER TABLE load_test_report
|
||||||
|
|
||||||
ALTER TABLE load_test_report
|
ALTER TABLE load_test_report
|
||||||
MODIFY test_name VARCHAR(255) NULL;
|
MODIFY test_name VARCHAR(255) NULL;
|
||||||
|
|
||||||
|
ALTER TABLE `test_plan_report_content`
|
||||||
|
ADD COLUMN `api_base_count` LONGTEXT COMMENT 'request (JSON format)';
|
Loading…
Reference in New Issue