jmeter性能测试及报告初步提交

This commit is contained in:
liangdaliang
2025-04-15 11:57:12 +08:00
parent 082094d9ef
commit cb7a7c947c
8 changed files with 1332 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package com.test.test.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author liangdaliang
* @Description
* @date 2025-04-14 16:59
*/
@RestController
@RequestMapping("/test/performanceReport")
public class PerformanceReportController {
}

View File

@@ -0,0 +1,241 @@
package com.test.test.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.test.common.annotation.Excel;
import com.test.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 性能测试用例报告对象 performance_test_case_report
*
* @author test
* @date 2025-04-14
*/
public class PerformanceTestCaseReport extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 性能测试id外键 */
@Excel(name = "性能测试id", readConverterExp = "外=键")
private Long performanceId;
/** 测试用例id外键 */
@Excel(name = "测试用例id", readConverterExp = "外=键")
private Long testCaseId;
/** 性能测试执行批次id取当前系统时间戳 */
@Excel(name = "性能测试执行批次id取当前系统时间戳")
private Long sid;
/** 并发线程数 */
@Excel(name = "并发线程数")
private Long concurrentThreads;
/** 平均响应时间(毫秒) */
@Excel(name = "平均响应时间", readConverterExp = "毫=秒")
private Long average;
/** tps */
@Excel(name = "tps")
private String tps;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 耗时(毫秒) */
@Excel(name = "耗时", readConverterExp = "毫=秒")
private Long costTime;
/** 触发方式1-定时任务2-手动 */
@Excel(name = "触发方式1-定时任务2-手动")
private Long triggerType;
/** 性能测试汇总报告json数组 */
@Excel(name = "性能测试汇总报告json数组")
private String summaryReport;
/** 申请人姓名 */
@Excel(name = "申请人姓名")
private String applyUser;
/** 是否已执行完成状态0否1是默认0 */
@Excel(name = "是否已执行完成状态0否1是默认0")
private String status;
/** 删除标记:0正常1删除 */
private String delFlag;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setPerformanceId(Long performanceId)
{
this.performanceId = performanceId;
}
public Long getPerformanceId()
{
return performanceId;
}
public void setTestCaseId(Long testCaseId)
{
this.testCaseId = testCaseId;
}
public Long getTestCaseId()
{
return testCaseId;
}
public void setSid(Long sid)
{
this.sid = sid;
}
public Long getSid()
{
return sid;
}
public void setConcurrentThreads(Long concurrentThreads)
{
this.concurrentThreads = concurrentThreads;
}
public Long getConcurrentThreads()
{
return concurrentThreads;
}
public void setAverage(Long average)
{
this.average = average;
}
public Long getAverage()
{
return average;
}
public void setTps(String tps)
{
this.tps = tps;
}
public String getTps()
{
return tps;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public void setCostTime(Long costTime)
{
this.costTime = costTime;
}
public Long getCostTime()
{
return costTime;
}
public void setTriggerType(Long triggerType)
{
this.triggerType = triggerType;
}
public Long getTriggerType()
{
return triggerType;
}
public void setSummaryReport(String summaryReport)
{
this.summaryReport = summaryReport;
}
public String getSummaryReport()
{
return summaryReport;
}
public void setApplyUser(String applyUser)
{
this.applyUser = applyUser;
}
public String getApplyUser()
{
return applyUser;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("performanceId", getPerformanceId())
.append("testCaseId", getTestCaseId())
.append("sid", getSid())
.append("concurrentThreads", getConcurrentThreads())
.append("average", getAverage())
.append("tps", getTps())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("costTime", getCostTime())
.append("triggerType", getTriggerType())
.append("summaryReport", getSummaryReport())
.append("applyUser", getApplyUser())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@@ -0,0 +1,62 @@
package com.test.test.mapper;
import com.test.test.domain.PerformanceTestCaseReport;
import java.util.List;
/**
* 性能测试用例报告Mapper接口
*
* @author test
* @date 2025-04-14
*/
public interface PerformanceTestCaseReportMapper
{
/**
* 查询性能测试用例报告
*
* @param id 性能测试用例报告主键
* @return 性能测试用例报告
*/
public PerformanceTestCaseReport selectPerformanceTestCaseReportById(Long id);
/**
* 查询性能测试用例报告列表
*
* @param performanceTestCaseReport 性能测试用例报告
* @return 性能测试用例报告集合
*/
public List<PerformanceTestCaseReport> selectPerformanceTestCaseReportList(PerformanceTestCaseReport performanceTestCaseReport);
/**
* 新增性能测试用例报告
*
* @param performanceTestCaseReport 性能测试用例报告
* @return 结果
*/
public int insertPerformanceTestCaseReport(PerformanceTestCaseReport performanceTestCaseReport);
/**
* 修改性能测试用例报告
*
* @param performanceTestCaseReport 性能测试用例报告
* @return 结果
*/
public int updatePerformanceTestCaseReport(PerformanceTestCaseReport performanceTestCaseReport);
/**
* 删除性能测试用例报告
*
* @param id 性能测试用例报告主键
* @return 结果
*/
public int deletePerformanceTestCaseReportById(Long id);
/**
* 批量删除性能测试用例报告
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deletePerformanceTestCaseReportByIds(Long[] ids);
}

View File

@@ -0,0 +1,62 @@
package com.test.test.service;
import com.test.test.domain.PerformanceTestCaseReport;
import java.util.List;
/**
* 性能测试用例报告Service接口
*
* @author test
* @date 2025-04-14
*/
public interface IPerformanceTestCaseReportService
{
/**
* 查询性能测试用例报告
*
* @param id 性能测试用例报告主键
* @return 性能测试用例报告
*/
public PerformanceTestCaseReport selectPerformanceTestCaseReportById(Long id);
/**
* 查询性能测试用例报告列表
*
* @param performanceTestCaseReport 性能测试用例报告
* @return 性能测试用例报告集合
*/
public List<PerformanceTestCaseReport> selectPerformanceTestCaseReportList(PerformanceTestCaseReport performanceTestCaseReport);
/**
* 新增性能测试用例报告
*
* @param performanceTestCaseReport 性能测试用例报告
* @return 结果
*/
public int insertPerformanceTestCaseReport(PerformanceTestCaseReport performanceTestCaseReport);
/**
* 修改性能测试用例报告
*
* @param performanceTestCaseReport 性能测试用例报告
* @return 结果
*/
public int updatePerformanceTestCaseReport(PerformanceTestCaseReport performanceTestCaseReport);
/**
* 批量删除性能测试用例报告
*
* @param ids 需要删除的性能测试用例报告主键集合
* @return 结果
*/
public int deletePerformanceTestCaseReportByIds(Long[] ids);
/**
* 删除性能测试用例报告信息
*
* @param id 性能测试用例报告主键
* @return 结果
*/
public int deletePerformanceTestCaseReportById(Long id);
}

View File

@@ -0,0 +1,97 @@
package com.test.test.service.impl;
import com.test.common.utils.DateUtils;
import com.test.test.domain.PerformanceTestCaseReport;
import com.test.test.mapper.PerformanceTestCaseReportMapper;
import com.test.test.service.IPerformanceTestCaseReportService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 性能测试用例报告Service业务层处理
*
* @author test
* @date 2025-04-14
*/
@Service
public class PerformanceTestCaseReportServiceImpl implements IPerformanceTestCaseReportService
{
@Resource
private PerformanceTestCaseReportMapper performanceTestCaseReportMapper;
/**
* 查询性能测试用例报告
*
* @param id 性能测试用例报告主键
* @return 性能测试用例报告
*/
@Override
public PerformanceTestCaseReport selectPerformanceTestCaseReportById(Long id)
{
return performanceTestCaseReportMapper.selectPerformanceTestCaseReportById(id);
}
/**
* 查询性能测试用例报告列表
*
* @param performanceTestCaseReport 性能测试用例报告
* @return 性能测试用例报告
*/
@Override
public List<PerformanceTestCaseReport> selectPerformanceTestCaseReportList(PerformanceTestCaseReport performanceTestCaseReport)
{
return performanceTestCaseReportMapper.selectPerformanceTestCaseReportList(performanceTestCaseReport);
}
/**
* 新增性能测试用例报告
*
* @param performanceTestCaseReport 性能测试用例报告
* @return 结果
*/
@Override
public int insertPerformanceTestCaseReport(PerformanceTestCaseReport performanceTestCaseReport)
{
performanceTestCaseReport.setCreateTime(DateUtils.getNowDate());
return performanceTestCaseReportMapper.insertPerformanceTestCaseReport(performanceTestCaseReport);
}
/**
* 修改性能测试用例报告
*
* @param performanceTestCaseReport 性能测试用例报告
* @return 结果
*/
@Override
public int updatePerformanceTestCaseReport(PerformanceTestCaseReport performanceTestCaseReport)
{
performanceTestCaseReport.setUpdateTime(DateUtils.getNowDate());
return performanceTestCaseReportMapper.updatePerformanceTestCaseReport(performanceTestCaseReport);
}
/**
* 批量删除性能测试用例报告
*
* @param ids 需要删除的性能测试用例报告主键
* @return 结果
*/
@Override
public int deletePerformanceTestCaseReportByIds(Long[] ids)
{
return performanceTestCaseReportMapper.deletePerformanceTestCaseReportByIds(ids);
}
/**
* 删除性能测试用例报告信息
*
* @param id 性能测试用例报告主键
* @return 结果
*/
@Override
public int deletePerformanceTestCaseReportById(Long id)
{
return performanceTestCaseReportMapper.deletePerformanceTestCaseReportById(id);
}
}

View File

@@ -0,0 +1,136 @@
<?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">
<mapper namespace="com.test.test.mapper.PerformanceTestCaseReportMapper">
<resultMap type="PerformanceTestCaseReport" id="PerformanceTestCaseReportResult">
<result property="id" column="id" />
<result property="performanceId" column="performance_id" />
<result property="testCaseId" column="test_case_id" />
<result property="sid" column="sid" />
<result property="concurrentThreads" column="concurrent_threads" />
<result property="average" column="average" />
<result property="tps" column="tps" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="costTime" column="cost_time" />
<result property="triggerType" column="trigger_type" />
<result property="summaryReport" column="summary_report" />
<result property="applyUser" column="apply_user" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectPerformanceTestCaseReportVo">
select id, performance_id, test_case_id, sid, concurrent_threads, average, tps, start_time, end_time, cost_time, trigger_type, summary_report, apply_user, status, del_flag, create_by, update_by, create_time, update_time from performance_test_case_report
</sql>
<select id="selectPerformanceTestCaseReportList" parameterType="PerformanceTestCaseReport" resultMap="PerformanceTestCaseReportResult">
<include refid="selectPerformanceTestCaseReportVo"/>
<where>
<if test="performanceId != null "> and performance_id = #{performanceId}</if>
<if test="testCaseId != null "> and test_case_id = #{testCaseId}</if>
<if test="sid != null "> and sid = #{sid}</if>
<if test="concurrentThreads != null "> and concurrent_threads = #{concurrentThreads}</if>
<if test="average != null "> and average = #{average}</if>
<if test="tps != null and tps != ''"> and tps = #{tps}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
<if test="costTime != null "> and cost_time = #{costTime}</if>
<if test="triggerType != null "> and trigger_type = #{triggerType}</if>
<if test="summaryReport != null and summaryReport != ''"> and summary_report = #{summaryReport}</if>
<if test="applyUser != null and applyUser != ''"> and apply_user = #{applyUser}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectPerformanceTestCaseReportById" parameterType="Long" resultMap="PerformanceTestCaseReportResult">
<include refid="selectPerformanceTestCaseReportVo"/>
where id = #{id}
</select>
<insert id="insertPerformanceTestCaseReport" parameterType="PerformanceTestCaseReport" useGeneratedKeys="true" keyProperty="id">
insert into performance_test_case_report
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="performanceId != null">performance_id,</if>
<if test="testCaseId != null">test_case_id,</if>
<if test="sid != null">sid,</if>
<if test="concurrentThreads != null">concurrent_threads,</if>
<if test="average != null">average,</if>
<if test="tps != null">tps,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="costTime != null">cost_time,</if>
<if test="triggerType != null">trigger_type,</if>
<if test="summaryReport != null">summary_report,</if>
<if test="applyUser != null">apply_user,</if>
<if test="status != null">status,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="performanceId != null">#{performanceId},</if>
<if test="testCaseId != null">#{testCaseId},</if>
<if test="sid != null">#{sid},</if>
<if test="concurrentThreads != null">#{concurrentThreads},</if>
<if test="average != null">#{average},</if>
<if test="tps != null">#{tps},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="costTime != null">#{costTime},</if>
<if test="triggerType != null">#{triggerType},</if>
<if test="summaryReport != null">#{summaryReport},</if>
<if test="applyUser != null">#{applyUser},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updatePerformanceTestCaseReport" parameterType="PerformanceTestCaseReport">
update performance_test_case_report
<trim prefix="SET" suffixOverrides=",">
<if test="performanceId != null">performance_id = #{performanceId},</if>
<if test="testCaseId != null">test_case_id = #{testCaseId},</if>
<if test="sid != null">sid = #{sid},</if>
<if test="concurrentThreads != null">concurrent_threads = #{concurrentThreads},</if>
<if test="average != null">average = #{average},</if>
<if test="tps != null">tps = #{tps},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="costTime != null">cost_time = #{costTime},</if>
<if test="triggerType != null">trigger_type = #{triggerType},</if>
<if test="summaryReport != null">summary_report = #{summaryReport},</if>
<if test="applyUser != null">apply_user = #{applyUser},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deletePerformanceTestCaseReportById" parameterType="Long">
delete from performance_test_case_report where id = #{id}
</delete>
<delete id="deletePerformanceTestCaseReportByIds" parameterType="String">
delete from performance_test_case_report where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>