Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
5c40ea5327
|
@ -11,8 +11,6 @@ public class LoadTest implements Serializable {
|
|||
|
||||
private String description;
|
||||
|
||||
private String scenarioDefinition;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private Long updateTime;
|
||||
|
@ -55,14 +53,6 @@ public class LoadTest implements Serializable {
|
|||
this.description = description == null ? null : description.trim();
|
||||
}
|
||||
|
||||
public String getScenarioDefinition() {
|
||||
return scenarioDefinition;
|
||||
}
|
||||
|
||||
public void setScenarioDefinition(String scenarioDefinition) {
|
||||
this.scenarioDefinition = scenarioDefinition == null ? null : scenarioDefinition.trim();
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
|
|
@ -384,76 +384,6 @@ public class LoadTestExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionIsNull() {
|
||||
addCriterion("scenario_definition is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionIsNotNull() {
|
||||
addCriterion("scenario_definition is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionEqualTo(String value) {
|
||||
addCriterion("scenario_definition =", value, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionNotEqualTo(String value) {
|
||||
addCriterion("scenario_definition <>", value, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionGreaterThan(String value) {
|
||||
addCriterion("scenario_definition >", value, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("scenario_definition >=", value, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionLessThan(String value) {
|
||||
addCriterion("scenario_definition <", value, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionLessThanOrEqualTo(String value) {
|
||||
addCriterion("scenario_definition <=", value, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionLike(String value) {
|
||||
addCriterion("scenario_definition like", value, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionNotLike(String value) {
|
||||
addCriterion("scenario_definition not like", value, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionIn(List<String> values) {
|
||||
addCriterion("scenario_definition in", values, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionNotIn(List<String> values) {
|
||||
addCriterion("scenario_definition not in", values, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionBetween(String value1, String value2) {
|
||||
addCriterion("scenario_definition between", value1, value2, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andScenarioDefinitionNotBetween(String value1, String value2) {
|
||||
addCriterion("scenario_definition not between", value1, value2, "scenarioDefinition");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIsNull() {
|
||||
addCriterion("create_time is null");
|
||||
return (Criteria) this;
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class LoadTestReportResult implements Serializable {
|
||||
private Long id;
|
||||
|
||||
private String reportId;
|
||||
|
||||
private String reportKey;
|
||||
|
||||
private String reportValue;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getReportId() {
|
||||
return reportId;
|
||||
}
|
||||
|
||||
public void setReportId(String reportId) {
|
||||
this.reportId = reportId == null ? null : reportId.trim();
|
||||
}
|
||||
|
||||
public String getReportKey() {
|
||||
return reportKey;
|
||||
}
|
||||
|
||||
public void setReportKey(String reportKey) {
|
||||
this.reportKey = reportKey == null ? null : reportKey.trim();
|
||||
}
|
||||
|
||||
public String getReportValue() {
|
||||
return reportValue;
|
||||
}
|
||||
|
||||
public void setReportValue(String reportValue) {
|
||||
this.reportValue = reportValue == null ? null : reportValue.trim();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,400 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LoadTestReportResultExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public LoadTestReportResultExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Long value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Long value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Long value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Long value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Long> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Long> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Long value1, Long value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIsNull() {
|
||||
addCriterion("report_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIsNotNull() {
|
||||
addCriterion("report_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdEqualTo(String value) {
|
||||
addCriterion("report_id =", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotEqualTo(String value) {
|
||||
addCriterion("report_id <>", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdGreaterThan(String value) {
|
||||
addCriterion("report_id >", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("report_id >=", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLessThan(String value) {
|
||||
addCriterion("report_id <", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("report_id <=", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLike(String value) {
|
||||
addCriterion("report_id like", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotLike(String value) {
|
||||
addCriterion("report_id not like", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIn(List<String> values) {
|
||||
addCriterion("report_id in", values, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotIn(List<String> values) {
|
||||
addCriterion("report_id not in", values, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdBetween(String value1, String value2) {
|
||||
addCriterion("report_id between", value1, value2, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotBetween(String value1, String value2) {
|
||||
addCriterion("report_id not between", value1, value2, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyIsNull() {
|
||||
addCriterion("report_key is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyIsNotNull() {
|
||||
addCriterion("report_key is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyEqualTo(String value) {
|
||||
addCriterion("report_key =", value, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyNotEqualTo(String value) {
|
||||
addCriterion("report_key <>", value, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyGreaterThan(String value) {
|
||||
addCriterion("report_key >", value, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("report_key >=", value, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyLessThan(String value) {
|
||||
addCriterion("report_key <", value, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyLessThanOrEqualTo(String value) {
|
||||
addCriterion("report_key <=", value, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyLike(String value) {
|
||||
addCriterion("report_key like", value, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyNotLike(String value) {
|
||||
addCriterion("report_key not like", value, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyIn(List<String> values) {
|
||||
addCriterion("report_key in", values, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyNotIn(List<String> values) {
|
||||
addCriterion("report_key not in", values, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyBetween(String value1, String value2) {
|
||||
addCriterion("report_key between", value1, value2, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportKeyNotBetween(String value1, String value2) {
|
||||
addCriterion("report_key not between", value1, value2, "reportKey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@
|
|||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||
<result column="scenario_definition" jdbcType="VARCHAR" property="scenarioDefinition" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
|
@ -76,8 +75,7 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, project_id, name, description, scenario_definition, create_time, update_time,
|
||||
status, test_resource_pool_id
|
||||
id, project_id, name, description, create_time, update_time, status, test_resource_pool_id
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
load_configuration, advanced_configuration, schedule
|
||||
|
@ -132,15 +130,15 @@
|
|||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestWithBLOBs">
|
||||
insert into load_test (id, project_id, name,
|
||||
description, scenario_definition, create_time,
|
||||
update_time, status, test_resource_pool_id,
|
||||
load_configuration, advanced_configuration,
|
||||
schedule)
|
||||
description, create_time, update_time,
|
||||
status, test_resource_pool_id, load_configuration,
|
||||
advanced_configuration, schedule
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{description,jdbcType=VARCHAR}, #{scenarioDefinition,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||
#{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR},
|
||||
#{loadConfiguration,jdbcType=LONGVARCHAR}, #{advancedConfiguration,jdbcType=LONGVARCHAR},
|
||||
#{schedule,jdbcType=LONGVARCHAR})
|
||||
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{status,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR}, #{loadConfiguration,jdbcType=LONGVARCHAR},
|
||||
#{advancedConfiguration,jdbcType=LONGVARCHAR}, #{schedule,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestWithBLOBs">
|
||||
insert into load_test
|
||||
|
@ -157,9 +155,6 @@
|
|||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
<if test="scenarioDefinition != null">
|
||||
scenario_definition,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
|
@ -195,9 +190,6 @@
|
|||
<if test="description != null">
|
||||
#{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="scenarioDefinition != null">
|
||||
#{scenarioDefinition,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
|
@ -242,9 +234,6 @@
|
|||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.scenarioDefinition != null">
|
||||
scenario_definition = #{record.scenarioDefinition,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
|
@ -277,7 +266,6 @@
|
|||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
name = #{record.name,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
scenario_definition = #{record.scenarioDefinition,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
status = #{record.status,jdbcType=VARCHAR},
|
||||
|
@ -295,7 +283,6 @@
|
|||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
name = #{record.name,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
scenario_definition = #{record.scenarioDefinition,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
status = #{record.status,jdbcType=VARCHAR},
|
||||
|
@ -316,9 +303,6 @@
|
|||
<if test="description != null">
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="scenarioDefinition != null">
|
||||
scenario_definition = #{scenarioDefinition,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
|
@ -348,7 +332,6 @@
|
|||
set project_id = #{projectId,jdbcType=VARCHAR},
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
scenario_definition = #{scenarioDefinition,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
|
@ -363,7 +346,6 @@
|
|||
set project_id = #{projectId,jdbcType=VARCHAR},
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
scenario_definition = #{scenarioDefinition,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
status = #{status,jdbcType=VARCHAR},
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package io.metersphere.base.mapper;
|
||||
|
||||
import io.metersphere.base.domain.LoadTestReportResult;
|
||||
import io.metersphere.base.domain.LoadTestReportResultExample;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface LoadTestReportResultMapper {
|
||||
long countByExample(LoadTestReportResultExample example);
|
||||
|
||||
int deleteByExample(LoadTestReportResultExample example);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(LoadTestReportResult record);
|
||||
|
||||
int insertSelective(LoadTestReportResult record);
|
||||
|
||||
List<LoadTestReportResult> selectByExampleWithBLOBs(LoadTestReportResultExample example);
|
||||
|
||||
List<LoadTestReportResult> selectByExample(LoadTestReportResultExample example);
|
||||
|
||||
LoadTestReportResult selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") LoadTestReportResult record, @Param("example") LoadTestReportResultExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") LoadTestReportResult record, @Param("example") LoadTestReportResultExample example);
|
||||
|
||||
int updateByExample(@Param("record") LoadTestReportResult record, @Param("example") LoadTestReportResultExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(LoadTestReportResult record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(LoadTestReportResult record);
|
||||
|
||||
int updateByPrimaryKey(LoadTestReportResult record);
|
||||
}
|
|
@ -0,0 +1,234 @@
|
|||
<?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="io.metersphere.base.mapper.LoadTestReportResultMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.LoadTestReportResult">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
|
||||
<result column="report_key" jdbcType="VARCHAR" property="reportKey" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestReportResult">
|
||||
<result column="report_value" jdbcType="LONGVARCHAR" property="reportValue" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, report_id, report_key
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
report_value
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportResultExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from load_test_report_result
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.LoadTestReportResultExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from load_test_report_result
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from load_test_report_result
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from load_test_report_result
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.LoadTestReportResultExample">
|
||||
delete from load_test_report_result
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.LoadTestReportResult">
|
||||
insert into load_test_report_result (id, report_id, report_key,
|
||||
report_value)
|
||||
values (#{id,jdbcType=BIGINT}, #{reportId,jdbcType=VARCHAR}, #{reportKey,jdbcType=VARCHAR},
|
||||
#{reportValue,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestReportResult">
|
||||
insert into load_test_report_result
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="reportId != null">
|
||||
report_id,
|
||||
</if>
|
||||
<if test="reportKey != null">
|
||||
report_key,
|
||||
</if>
|
||||
<if test="reportValue != null">
|
||||
report_value,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="reportId != null">
|
||||
#{reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="reportKey != null">
|
||||
#{reportKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="reportValue != null">
|
||||
#{reportValue,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.LoadTestReportResultExample" resultType="java.lang.Long">
|
||||
select count(*) from load_test_report_result
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update load_test_report_result
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.reportId != null">
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.reportKey != null">
|
||||
report_key = #{record.reportKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.reportValue != null">
|
||||
report_value = #{record.reportValue,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update load_test_report_result
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
report_key = #{record.reportKey,jdbcType=VARCHAR},
|
||||
report_value = #{record.reportValue,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update load_test_report_result
|
||||
set id = #{record.id,jdbcType=BIGINT},
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
report_key = #{record.reportKey,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.LoadTestReportResult">
|
||||
update load_test_report_result
|
||||
<set>
|
||||
<if test="reportId != null">
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="reportKey != null">
|
||||
report_key = #{reportKey,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="reportValue != null">
|
||||
report_value = #{reportValue,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.LoadTestReportResult">
|
||||
update load_test_report_result
|
||||
set report_id = #{reportId,jdbcType=VARCHAR},
|
||||
report_key = #{reportKey,jdbcType=VARCHAR},
|
||||
report_value = #{reportValue,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.LoadTestReportResult">
|
||||
update load_test_report_result
|
||||
set report_id = #{reportId,jdbcType=VARCHAR},
|
||||
report_key = #{reportKey,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
|
@ -19,10 +19,16 @@
|
|||
select ltr.id, ltr.name, ltr.test_id as testId, ltr.description,
|
||||
ltr.create_time as createTime, ltr.update_time as updateTime, ltr.status as status, lt.name as testName
|
||||
from load_test_report ltr join load_test lt on ltr.test_id = lt.id
|
||||
<if test="reportRequest.workspaceId != null">
|
||||
JOIN project on project.id = lt.project_id
|
||||
</if>
|
||||
<where>
|
||||
<if test="reportRequest.name != null">
|
||||
AND ltr.name like CONCAT('%', #{reportRequest.name},'%')
|
||||
</if>
|
||||
<if test="reportRequest.workspaceId != null">
|
||||
AND workspace_id = #{reportRequest.workspaceId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY ltr.update_time DESC
|
||||
</select>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package io.metersphere.commons.constants;
|
||||
|
||||
public enum PerformanceTestStatus {
|
||||
Saved, Starting, Running, Completed, Error
|
||||
Saved, Starting, Running, Reporting, Completed, Error
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package io.metersphere.commons.constants;
|
||||
|
||||
public enum ReportKeys {
|
||||
LoadChart, ResponseTimeChart, Errors, ErrorsTop5, RequestStatistics, Overview, TimeInfo
|
||||
|
||||
}
|
|
@ -27,7 +27,7 @@ public class PerformanceReportController {
|
|||
|
||||
@GetMapping("/recent/{count}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
||||
public List<LoadTestReport> recentProjects(@PathVariable int count) {
|
||||
public List<ReportDTO> recentProjects(@PathVariable int count) {
|
||||
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
ReportRequest request = new ReportRequest();
|
||||
request.setWorkspaceId(currentWorkspaceId);
|
||||
|
@ -38,6 +38,8 @@ public class PerformanceReportController {
|
|||
|
||||
@PostMapping("/list/all/{goPage}/{pageSize}")
|
||||
public Pager<List<ReportDTO>> getReportList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ReportRequest request) {
|
||||
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
request.setWorkspaceId(currentWorkspaceId);
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, reportService.getReportList(request));
|
||||
}
|
||||
|
|
|
@ -23,15 +23,15 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
|
||||
Set<String> testCaseNames;
|
||||
|
||||
Set<String> userNames;
|
||||
Set<String> userIds;
|
||||
|
||||
public TestCaseDataListener(TestCaseService testCaseService, String projectId,
|
||||
Set<String> testCaseNames, Set<String> userNames, Class<TestCaseExcelData> clazz) {
|
||||
Set<String> testCaseNames, Set<String> userIds, Class<TestCaseExcelData> clazz) {
|
||||
super(clazz);
|
||||
this.testCaseService = testCaseService;
|
||||
this.projectId = projectId;
|
||||
this.testCaseNames = testCaseNames;
|
||||
this.userNames = userNames;
|
||||
this.userIds = userIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
if ( nodePath.trim().contains(" ")) {
|
||||
stringBuilder.append("所属模块不能包含空格");
|
||||
}
|
||||
if (!userNames.contains(data.getMaintainer())) {
|
||||
if (!userIds.contains(data.getMaintainer())) {
|
||||
stringBuilder.append("该工作空间下无该用户:" + data.getMaintainer() + ";");
|
||||
}
|
||||
if (testCaseNames.contains(data.getName())) {
|
||||
|
|
|
@ -1,135 +0,0 @@
|
|||
package io.metersphere.report;
|
||||
|
||||
import com.opencsv.bean.CsvToBean;
|
||||
import com.opencsv.bean.CsvToBeanBuilder;
|
||||
import com.opencsv.bean.HeaderColumnNameMappingStrategy;
|
||||
import io.metersphere.report.base.*;
|
||||
import io.metersphere.report.parse.ResultDataParse;
|
||||
import org.apache.jmeter.report.processor.ErrorsSummaryConsumer;
|
||||
import org.apache.jmeter.report.processor.StatisticsSummaryConsumer;
|
||||
import org.apache.jmeter.report.processor.Top5ErrorsBySamplerConsumer;
|
||||
import org.apache.jmeter.report.processor.graph.impl.ActiveThreadsGraphConsumer;
|
||||
import org.apache.jmeter.report.processor.graph.impl.HitsPerSecondGraphConsumer;
|
||||
import org.apache.jmeter.report.processor.graph.impl.ResponseTimeOverTimeGraphConsumer;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
public class GenerateReport {
|
||||
|
||||
private static List<Metric> resolver(String jtlString) {
|
||||
HeaderColumnNameMappingStrategy<Metric> ms = new HeaderColumnNameMappingStrategy<>();
|
||||
ms.setType(Metric.class);
|
||||
try (Reader reader = new StringReader(jtlString)) {
|
||||
CsvToBean<Metric> cb = new CsvToBeanBuilder<Metric>(reader)
|
||||
.withType(Metric.class)
|
||||
.withSkipLines(0)
|
||||
.withMappingStrategy(ms)
|
||||
.withIgnoreLeadingWhiteSpace(true)
|
||||
.build();
|
||||
return cb.parse();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Errors> getErrorsList(String jtlString) {
|
||||
Map<String, Object> statisticsDataMap = ResultDataParse.getSummryDataMap(jtlString, new ErrorsSummaryConsumer());
|
||||
return ResultDataParse.summaryMapParsing(statisticsDataMap, Errors.class);
|
||||
}
|
||||
|
||||
public static List<ErrorsTop5> getErrorsTop5List(String jtlString) {
|
||||
Map<String, Object> statisticsDataMap = ResultDataParse.getSummryDataMap(jtlString, new Top5ErrorsBySamplerConsumer());
|
||||
return ResultDataParse.summaryMapParsing(statisticsDataMap, ErrorsTop5.class);
|
||||
}
|
||||
|
||||
public static List<Statistics> getRequestStatistics(String jtlString) {
|
||||
Map<String, Object> statisticsDataMap = ResultDataParse.getSummryDataMap(jtlString, new StatisticsSummaryConsumer());
|
||||
return ResultDataParse.summaryMapParsing(statisticsDataMap, Statistics.class);
|
||||
}
|
||||
|
||||
public static TestOverview getTestOverview(String jtlString) {
|
||||
DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
||||
|
||||
Map<String, Object> activeDataMap = ResultDataParse.getGraphDataMap(jtlString, new ActiveThreadsGraphConsumer());
|
||||
List<ChartsData> usersList = ResultDataParse.graphMapParsing(activeDataMap, "users");
|
||||
Optional<ChartsData> max = usersList.stream().max(Comparator.comparing(ChartsData::getyAxis));
|
||||
int maxUser = max.get().getyAxis().setScale(0, BigDecimal.ROUND_UP).intValue();
|
||||
|
||||
Map<String, Object> hitsDataMap = ResultDataParse.getGraphDataMap(jtlString, new HitsPerSecondGraphConsumer());
|
||||
List<ChartsData> hitsList = ResultDataParse.graphMapParsing(hitsDataMap, "hits");
|
||||
double hits = hitsList.stream().map(ChartsData::getyAxis)
|
||||
.mapToDouble(BigDecimal::doubleValue)
|
||||
.average().orElse(0);
|
||||
|
||||
Map<String, Object> errorDataMap = ResultDataParse.getSummryDataMap(jtlString, new StatisticsSummaryConsumer());
|
||||
List<Statistics> statisticsList = ResultDataParse.summaryMapParsing(errorDataMap, Statistics.class);
|
||||
Optional<Double> error = statisticsList.stream().map(item -> Double.parseDouble(item.getError())).reduce(Double::sum);
|
||||
double avgTp90 = statisticsList.stream().map(item -> Double.parseDouble(item.getTp90())).mapToDouble(Double::doubleValue).average().orElse(0);
|
||||
double avgBandwidth = statisticsList.stream().map(item -> Double.parseDouble(item.getReceived())).mapToDouble(Double::doubleValue).average().orElse(0);
|
||||
|
||||
Map<String, Object> responseDataMap = ResultDataParse.getGraphDataMap(jtlString, new ResponseTimeOverTimeGraphConsumer());
|
||||
List<ChartsData> responseDataList = ResultDataParse.graphMapParsing(responseDataMap, "response");
|
||||
double responseTime = responseDataList.stream().map(ChartsData::getyAxis)
|
||||
.mapToDouble(BigDecimal::doubleValue)
|
||||
.average().orElse(0);
|
||||
|
||||
TestOverview testOverview = new TestOverview();
|
||||
testOverview.setMaxUsers(String.valueOf(maxUser));
|
||||
testOverview.setAvgThroughput(decimalFormat.format(hits));
|
||||
testOverview.setErrors(decimalFormat.format(error.get()));
|
||||
testOverview.setAvgResponseTime(decimalFormat.format(responseTime / 1000));
|
||||
testOverview.setResponseTime90(decimalFormat.format(avgTp90 / 1000));
|
||||
testOverview.setAvgBandwidth(decimalFormat.format(avgBandwidth));
|
||||
return testOverview;
|
||||
}
|
||||
|
||||
public static List<ChartsData> getLoadChartData(String jtlString) {
|
||||
Map<String, Object> activeThreadMap = ResultDataParse.getGraphDataMap(jtlString, new ActiveThreadsGraphConsumer());
|
||||
Map<String, Object> hitsMap = ResultDataParse.getGraphDataMap(jtlString, new HitsPerSecondGraphConsumer());
|
||||
List<ChartsData> resultList = ResultDataParse.graphMapParsing(activeThreadMap, "users");
|
||||
List<ChartsData> hitsList = ResultDataParse.graphMapParsing(hitsMap, "hits");
|
||||
resultList.addAll(hitsList);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
public static List<ChartsData> getResponseTimeChartData(String jtlString) {
|
||||
Map<String, Object> activeThreadMap = ResultDataParse.getGraphDataMap(jtlString, new ActiveThreadsGraphConsumer());
|
||||
Map<String, Object> responseTimeMap = ResultDataParse.getGraphDataMap(jtlString, new ResponseTimeOverTimeGraphConsumer());
|
||||
List<ChartsData> resultList = ResultDataParse.graphMapParsing(activeThreadMap, "users");
|
||||
List<ChartsData> responseTimeList = ResultDataParse.graphMapParsing(responseTimeMap, "responseTime");
|
||||
resultList.addAll(responseTimeList);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
public static ReportTimeInfo getReportTimeInfo(String jtlString) {
|
||||
List<Metric> totalLineList = GenerateReport.resolver(jtlString);
|
||||
|
||||
totalLineList.sort(Comparator.comparing(t0 -> Long.valueOf(t0.getTimestamp())));
|
||||
|
||||
String startTimeStamp = totalLineList.get(0).getTimestamp();
|
||||
String endTimeStamp = totalLineList.get(totalLineList.size() - 1).getTimestamp();
|
||||
|
||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
|
||||
String startTime = dtf.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(Long.parseLong(startTimeStamp)), ZoneId.systemDefault()));
|
||||
String endTime = dtf.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(Long.parseLong(endTimeStamp)), ZoneId.systemDefault()));
|
||||
|
||||
// todo 时间问题
|
||||
long seconds = Duration.between(Instant.ofEpochMilli(Long.parseLong(startTimeStamp)), Instant.ofEpochMilli(Long.parseLong(endTimeStamp))).getSeconds();
|
||||
ReportTimeInfo reportTimeInfo = new ReportTimeInfo();
|
||||
reportTimeInfo.setStartTime(startTime);
|
||||
reportTimeInfo.setEndTime(endTime);
|
||||
reportTimeInfo.setDuration(String.valueOf(seconds));
|
||||
|
||||
return reportTimeInfo;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,190 +0,0 @@
|
|||
package io.metersphere.report.parse;
|
||||
|
||||
import io.metersphere.commons.utils.MsJMeterUtils;
|
||||
import io.metersphere.report.base.ChartsData;
|
||||
import org.apache.jmeter.report.core.Sample;
|
||||
import org.apache.jmeter.report.core.SampleMetadata;
|
||||
import org.apache.jmeter.report.dashboard.JsonizerVisitor;
|
||||
import org.apache.jmeter.report.processor.*;
|
||||
import org.apache.jmeter.report.processor.graph.AbstractOverTimeGraphConsumer;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
public class ResultDataParse {
|
||||
|
||||
private static final String DATE_TIME_PATTERN = "yyyy/MM/dd HH:mm:ss";
|
||||
private static final String TIME_PATTERN = "HH:mm:ss";
|
||||
|
||||
public static <T> List<T> summaryMapParsing(Map<String, Object> map, Class<T> clazz) {
|
||||
List<T> list = new ArrayList<>();
|
||||
for (String key : map.keySet()) {
|
||||
MapResultData mapResultData = (MapResultData) map.get(key);
|
||||
ListResultData items = (ListResultData) mapResultData.getResult("items");
|
||||
if (items.getSize() > 0) {
|
||||
for (int i = 0; i < items.getSize(); i++) {
|
||||
MapResultData resultData = (MapResultData) items.get(i);
|
||||
ListResultData data = (ListResultData) resultData.getResult("data");
|
||||
int size = data.getSize();
|
||||
String[] strArray = new String[size];
|
||||
if (size > 0) {
|
||||
T t = null;
|
||||
for (int j = 0; j < size; j++) {
|
||||
ValueResultData valueResultData = (ValueResultData) data.get(j);
|
||||
if (valueResultData.getValue() == null) {
|
||||
strArray[j] = "";
|
||||
} else {
|
||||
String accept = valueResultData.accept(new JsonizerVisitor());
|
||||
strArray[j] = accept.replace("\\", "");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
t = setParam(clazz, strArray);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
list.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ChartsData> graphMapParsing(Map<String, Object> map, String seriesName) {
|
||||
List<ChartsData> list = new ArrayList<>();
|
||||
// ThreadGroup
|
||||
for (String key : map.keySet()) {
|
||||
MapResultData mapResultData = (MapResultData) map.get(key);
|
||||
ResultData maxY = mapResultData.getResult("maxY");
|
||||
ListResultData series = (ListResultData) mapResultData.getResult("series");
|
||||
if (series.getSize() > 0) {
|
||||
for (int j = 0; j < series.getSize(); j++) {
|
||||
MapResultData resultData = (MapResultData) series.get(j);
|
||||
// data, isOverall, label, isController
|
||||
ListResultData data = (ListResultData) resultData.getResult("data");
|
||||
ValueResultData label = (ValueResultData) resultData.getResult("label");
|
||||
|
||||
if (data.getSize() > 0) {
|
||||
for (int i = 0; i < data.getSize(); i++) {
|
||||
ListResultData listResultData = (ListResultData) data.get(i);
|
||||
String result = listResultData.accept(new JsonizerVisitor());
|
||||
result = result.substring(1, result.length() - 1);
|
||||
String[] split = result.split(",");
|
||||
ChartsData chartsData = new ChartsData();
|
||||
BigDecimal bigDecimal = new BigDecimal(split[0]);
|
||||
String timeStamp = bigDecimal.toPlainString();
|
||||
String time = null;
|
||||
try {
|
||||
time = formatDate(stampToDate(DATE_TIME_PATTERN, timeStamp));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
chartsData.setxAxis(time);
|
||||
chartsData.setyAxis(new BigDecimal(split[1].trim()));
|
||||
if (series.getSize() == 1) {
|
||||
chartsData.setGroupName(seriesName);
|
||||
} else {
|
||||
chartsData.setGroupName((String) label.getValue());
|
||||
}
|
||||
list.add(chartsData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static Map<String, Object> getGraphDataMap(String jtlString, AbstractOverTimeGraphConsumer timeGraphConsumer) {
|
||||
AbstractOverTimeGraphConsumer abstractOverTimeGraphConsumer = timeGraphConsumer;
|
||||
abstractOverTimeGraphConsumer.setGranularity(60000);
|
||||
abstractOverTimeGraphConsumer.initialize();
|
||||
SampleContext sampleContext = initJmeterConsumer(jtlString, abstractOverTimeGraphConsumer);
|
||||
return sampleContext.getData();
|
||||
}
|
||||
|
||||
public static Map<String, Object> getSummryDataMap(String jtlString, AbstractSummaryConsumer<?> summaryConsumer) {
|
||||
AbstractSummaryConsumer<?> abstractSummaryConsumer = summaryConsumer;
|
||||
SampleContext sampleContext = initJmeterConsumer(jtlString, summaryConsumer);
|
||||
return sampleContext.getData();
|
||||
}
|
||||
|
||||
private static SampleContext initJmeterConsumer(String jtlString, AbstractSampleConsumer abstractSampleConsumer) {
|
||||
int row = 0;
|
||||
// 使用反射获取properties
|
||||
MsJMeterUtils.loadJMeterProperties("jmeter.properties");
|
||||
SampleMetadata sampleMetaData = createTestMetaData();
|
||||
SampleContext sampleContext = new SampleContext();
|
||||
abstractSampleConsumer.setSampleContext(sampleContext);
|
||||
abstractSampleConsumer.startConsuming();
|
||||
StringTokenizer tokenizer = new StringTokenizer(jtlString, "\n");
|
||||
// 去掉第一行
|
||||
tokenizer.nextToken();
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
String line = tokenizer.nextToken();
|
||||
String[] data = line.split(",", -1);
|
||||
Sample sample = new Sample(row++, sampleMetaData, data);
|
||||
abstractSampleConsumer.consume(sample, 0);
|
||||
}
|
||||
abstractSampleConsumer.stopConsuming();
|
||||
return sampleContext;
|
||||
}
|
||||
|
||||
// Create a static SampleMetadataObject
|
||||
private static SampleMetadata createTestMetaData() {
|
||||
String columnsString = "timeStamp,elapsed,label,responseCode,responseMessage,threadName,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect";
|
||||
columnsString = "timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect";
|
||||
|
||||
String[] columns = new String[17];
|
||||
int lastComa = 0;
|
||||
int columnIndex = 0;
|
||||
for (int i = 0; i < columnsString.length(); i++) {
|
||||
if (columnsString.charAt(i) == ',') {
|
||||
columns[columnIndex] = columnsString.substring(lastComa, i);
|
||||
lastComa = i + 1;
|
||||
columnIndex++;
|
||||
} else if (i + 1 == columnsString.length()) {
|
||||
columns[columnIndex] = columnsString.substring(lastComa, i + 1);
|
||||
}
|
||||
}
|
||||
return new SampleMetadata(',', columns);
|
||||
}
|
||||
|
||||
private static String stampToDate(String pattern, String timeStamp) {
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern);
|
||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(Long.parseLong(timeStamp)), ZoneId.systemDefault());
|
||||
return localDateTime.format(dateTimeFormatter);
|
||||
}
|
||||
|
||||
private static String formatDate(String dateString) throws ParseException {
|
||||
SimpleDateFormat before = new SimpleDateFormat(DATE_TIME_PATTERN);
|
||||
SimpleDateFormat after = new SimpleDateFormat(TIME_PATTERN);
|
||||
return after.format(before.parse(dateString));
|
||||
}
|
||||
|
||||
private static <T> T setParam(Class<T> clazz, Object[] args)
|
||||
throws Exception {
|
||||
if (clazz == null || args == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
T t = clazz.newInstance();
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
if (fields == null || fields.length > args.length) {
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
fields[i].setAccessible(true);
|
||||
fields[i].set(t, args[i]);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
}
|
|
@ -1,21 +1,24 @@
|
|||
package io.metersphere.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.LoadTestMapper;
|
||||
import io.metersphere.base.mapper.LoadTestReportMapper;
|
||||
import io.metersphere.base.mapper.LoadTestReportResultMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper;
|
||||
import io.metersphere.commons.constants.PerformanceTestStatus;
|
||||
import io.metersphere.commons.constants.ReportKeys;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.controller.request.ReportRequest;
|
||||
import io.metersphere.dto.ReportDTO;
|
||||
import io.metersphere.engine.Engine;
|
||||
import io.metersphere.engine.EngineFactory;
|
||||
import io.metersphere.report.GenerateReport;
|
||||
import io.metersphere.report.base.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -29,14 +32,11 @@ public class ReportService {
|
|||
private ExtLoadTestReportMapper extLoadTestReportMapper;
|
||||
@Resource
|
||||
private LoadTestMapper loadTestMapper;
|
||||
@Resource
|
||||
private LoadTestReportResultMapper loadTestReportResultMapper;
|
||||
|
||||
public List<LoadTestReport> getRecentReportList(ReportRequest request) {
|
||||
LoadTestReportExample example = new LoadTestReportExample();
|
||||
LoadTestReportExample.Criteria criteria = example.createCriteria();
|
||||
//
|
||||
|
||||
example.setOrderByClause("update_time desc");
|
||||
return loadTestReportMapper.selectByExample(example);
|
||||
public List<ReportDTO> getRecentReportList(ReportRequest request) {
|
||||
return extLoadTestReportMapper.getReportList(request);
|
||||
}
|
||||
|
||||
public List<ReportDTO> getReportList(ReportRequest request) {
|
||||
|
@ -80,58 +80,56 @@ public class ReportService {
|
|||
return extLoadTestReportMapper.getReportTestAndProInfo(reportId);
|
||||
}
|
||||
|
||||
private String getContent(String id, ReportKeys reportKey) {
|
||||
LoadTestReportResultExample example = new LoadTestReportResultExample();
|
||||
example.createCriteria().andReportIdEqualTo(id).andReportKeyEqualTo(reportKey.name());
|
||||
List<LoadTestReportResult> loadTestReportResults = loadTestReportResultMapper.selectByExampleWithBLOBs(example);
|
||||
if (loadTestReportResults.size() != 1) {
|
||||
MSException.throwException("get report result error.");
|
||||
}
|
||||
return loadTestReportResults.get(0).getReportValue();
|
||||
}
|
||||
|
||||
public List<Statistics> getReport(String id) {
|
||||
checkReportStatus(id);
|
||||
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(id);
|
||||
String content = loadTestReport.getContent();
|
||||
return GenerateReport.getRequestStatistics(content);
|
||||
String reportValue = getContent(id, ReportKeys.RequestStatistics);
|
||||
return JSON.parseArray(reportValue, Statistics.class);
|
||||
}
|
||||
|
||||
public List<Errors> getReportErrors(String id) {
|
||||
checkReportStatus(id);
|
||||
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(id);
|
||||
String content = loadTestReport.getContent();
|
||||
List<Errors> errors = GenerateReport.getErrorsList(content);
|
||||
return errors;
|
||||
String content = getContent(id, ReportKeys.Errors);
|
||||
return JSON.parseArray(content, Errors.class);
|
||||
}
|
||||
|
||||
public List<ErrorsTop5> getReportErrorsTOP5(String id) {
|
||||
checkReportStatus(id);
|
||||
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(id);
|
||||
String content = loadTestReport.getContent();
|
||||
List<ErrorsTop5> errorsTop5 = GenerateReport.getErrorsTop5List(content);
|
||||
return errorsTop5;
|
||||
String content = getContent(id, ReportKeys.ErrorsTop5);
|
||||
return JSON.parseArray(content, ErrorsTop5.class);
|
||||
}
|
||||
|
||||
public TestOverview getTestOverview(String id) {
|
||||
checkReportStatus(id);
|
||||
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(id);
|
||||
String content = loadTestReport.getContent();
|
||||
TestOverview testOverview = GenerateReport.getTestOverview(content);
|
||||
return testOverview;
|
||||
String content = getContent(id, ReportKeys.Overview);
|
||||
return JSON.parseObject(content, TestOverview.class);
|
||||
}
|
||||
|
||||
public ReportTimeInfo getReportTimeInfo(String id) {
|
||||
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(id);
|
||||
String content = loadTestReport.getContent();
|
||||
ReportTimeInfo reportTimeInfo = GenerateReport.getReportTimeInfo(content);
|
||||
return reportTimeInfo;
|
||||
checkReportStatus(id);
|
||||
String content = getContent(id, ReportKeys.TimeInfo);
|
||||
return JSON.parseObject(content, ReportTimeInfo.class);
|
||||
}
|
||||
|
||||
public List<ChartsData> getLoadChartData(String id) {
|
||||
checkReportStatus(id);
|
||||
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(id);
|
||||
String content = loadTestReport.getContent();
|
||||
List<ChartsData> chartsDataList = GenerateReport.getLoadChartData(content);
|
||||
return chartsDataList;
|
||||
String content = getContent(id, ReportKeys.LoadChart);
|
||||
return JSON.parseArray(content, ChartsData.class);
|
||||
}
|
||||
|
||||
public List<ChartsData> getResponseTimeChartData(String id) {
|
||||
checkReportStatus(id);
|
||||
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(id);
|
||||
String content = loadTestReport.getContent();
|
||||
List<ChartsData> chartsDataList = GenerateReport.getResponseTimeChartData(content);
|
||||
return chartsDataList;
|
||||
String content = getContent(id, ReportKeys.ResponseTimeChart);
|
||||
return JSON.parseArray(content, ChartsData.class);
|
||||
}
|
||||
|
||||
public void checkReportStatus(String reportId) {
|
||||
|
@ -139,6 +137,8 @@ public class ReportService {
|
|||
String reportStatus = loadTestReport.getStatus();
|
||||
if (StringUtils.equals(PerformanceTestStatus.Running.name(), reportStatus)) {
|
||||
MSException.throwException("Reporting in progress...");
|
||||
} else if (StringUtils.equals(PerformanceTestStatus.Reporting.name(), reportStatus)) {
|
||||
MSException.throwException("Reporting in progress...");
|
||||
} else if (StringUtils.equals(PerformanceTestStatus.Error.name(), reportStatus)) {
|
||||
MSException.throwException("Report generation error!");
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.github.pagehelper.PageHelper;
|
|||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.*;
|
||||
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.controller.request.testcase.QueryTestCaseRequest;
|
||||
import io.metersphere.excel.domain.ExcelErrData;
|
||||
|
@ -16,6 +17,8 @@ import io.metersphere.excel.domain.TestCaseExcelData;
|
|||
import io.metersphere.excel.listener.EasyExcelListener;
|
||||
import io.metersphere.excel.listener.TestCaseDataListener;
|
||||
import io.metersphere.excel.utils.EasyExcelUtil;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.user.SessionUser;
|
||||
import io.metersphere.user.SessionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
|
@ -61,6 +64,15 @@ public class TestCaseService {
|
|||
UserMapper userMapper;
|
||||
|
||||
public void addTestCase(TestCaseWithBLOBs testCase) {
|
||||
testCase.setName(testCase.getName());
|
||||
TestCaseExample testCaseExample = new TestCaseExample();
|
||||
testCaseExample.createCriteria()
|
||||
.andProjectIdEqualTo(testCase.getProjectId())
|
||||
.andNameEqualTo(testCase.getName());
|
||||
List<TestCase> testCases = testCaseMapper.selectByExample(testCaseExample);
|
||||
if (testCases.size() > 0) {
|
||||
MSException.throwException(Translator.get("test_case_exist") + testCase.getName());
|
||||
}
|
||||
testCase.setId(UUID.randomUUID().toString());
|
||||
testCase.setCreateTime(System.currentTimeMillis());
|
||||
testCase.setUpdateTime(System.currentTimeMillis());
|
||||
|
@ -181,10 +193,10 @@ public class TestCaseService {
|
|||
UserExample userExample = new UserExample();
|
||||
userExample.createCriteria().andLastWorkspaceIdEqualTo(currentWorkspaceId);
|
||||
List<User> users = userMapper.selectByExample(userExample);
|
||||
Set<String> userNames = users.stream().map(User::getName).collect(Collectors.toSet());
|
||||
Set<String> userIds = users.stream().map(User::getId).collect(Collectors.toSet());
|
||||
|
||||
EasyExcelListener easyExcelListener = new TestCaseDataListener(this, projectId,
|
||||
testCaseNames, userNames, TestCaseExcelData.class);
|
||||
testCaseNames, userIds, TestCaseExcelData.class);
|
||||
EasyExcelFactory.read(file.getInputStream(), TestCaseExcelData.class, easyExcelListener).sheet().doRead();
|
||||
|
||||
List<ExcelErrData<TestCaseExcelData>> errList = easyExcelListener.getErrList();
|
||||
|
@ -228,6 +240,7 @@ public class TestCaseService {
|
|||
StringBuilder path = new StringBuilder("");
|
||||
List<String> types = Arrays.asList("functional", "performance", "api");
|
||||
List<String> methods = Arrays.asList("manual", "auto");
|
||||
SessionUser user = SessionUtils.getUser();
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
TestCaseExcelData data = new TestCaseExcelData();
|
||||
data.setName("测试用例" + i);
|
||||
|
@ -239,7 +252,7 @@ public class TestCaseService {
|
|||
data.setPrerequisite("前置条件选填");
|
||||
data.setStepDesc("1. 每个步骤以换行分隔\n2. 步骤前可标序号\n3. 测试步骤和结果选填");
|
||||
data.setStepResult("1. 每条结果以换行分隔\n2. 结果前可标序号\n3. 测试步骤和结果选填");
|
||||
data.setMaintainer("admin");
|
||||
data.setMaintainer(user.getId());
|
||||
data.setRemark("备注选填");
|
||||
list.add(data);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ CREATE TABLE IF NOT EXISTS `load_test` (
|
|||
`project_id` varchar(50) NOT NULL COMMENT 'Project ID this test belongs to',
|
||||
`name` varchar(64) NOT NULL COMMENT 'Test name',
|
||||
`description` varchar(255) DEFAULT NULL COMMENT 'Test description',
|
||||
`scenario_definition` varchar(255) DEFAULT NULL COMMENT 'Scenario definition (JSON format)',
|
||||
`load_configuration` longtext COMMENT 'Load configuration (JSON format)',
|
||||
`advanced_configuration` longtext COMMENT 'Load configuration (JSON format)',
|
||||
`schedule` longtext COMMENT 'Test schedule (cron list)',
|
||||
|
@ -71,6 +70,19 @@ CREATE TABLE IF NOT EXISTS `load_test_report_detail` (
|
|||
DEFAULT CHARSET=utf8mb4
|
||||
COLLATE=utf8mb4_bin;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `load_test_report_result` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`report_id` varchar(50) NOT NULL,
|
||||
`report_key` varchar(64) DEFAULT NULL,
|
||||
`report_value` text,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `load_test_report_result_report_id_report_key_index` (`report_id`,`report_key`)
|
||||
)
|
||||
ENGINE=InnoDB
|
||||
DEFAULT CHARSET=utf8mb4
|
||||
COLLATE=utf8mb4_bin;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `organization` (
|
||||
`id` varchar(50) NOT NULL COMMENT 'Organization ID',
|
||||
`name` varchar(64) NOT NULL COMMENT 'Organization name',
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
test_case_exist=
|
|
@ -1,3 +1,4 @@
|
|||
test_case_exist=A test case already exists under this project:
|
||||
error_lang_invalid=Invalid language parameter
|
||||
load_test_already_exists=Duplicate load test name
|
||||
project_name_is_null=Project name cannot be null
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
error_lang_invalid=语言参数错误
|
||||
load_test_already_exists=测试名称不能重复
|
||||
project_name_is_null=项目名称不能为空
|
||||
project_name_already_exists=项目名称已存在
|
||||
workspace_name_is_null=工作空间名不能为空
|
||||
workspace_name_already_exists=工作空间名已存在
|
||||
workspace_does_not_belong_to_user=当前工作空间不属于当前用户
|
||||
organization_does_not_belong_to_user=当前组织不属于当前用户
|
||||
file_cannot_be_null=文件不能为空!
|
||||
edit_load_test_not_found=无法编辑测试,未找到测试:
|
||||
run_load_test_not_found=无法运行测试,未找到测试:
|
||||
run_load_test_file_not_found=无法运行测试,无法获取测试文件元信息,测试ID:
|
||||
run_load_test_file_content_not_found=无法运行测试,无法获取测试文件内容,测试ID:
|
||||
run_load_test_file_init_error=无法运行测试,初始化运行环境失败,测试ID:
|
||||
load_test_is_running=测试正在运行, 请等待
|
||||
node_deep_limit=节点深度不超过5层!
|
||||
no_nodes_message=没有节点信息
|
||||
duplicate_node_ip=节点 IP 重复
|
||||
only_one_k8s=只能添加一个 K8s
|
||||
organization_id_is_null=组织 ID 不能为空
|
||||
max_thread_insufficient=并发用户数超额
|
||||
cannot_edit_load_test_running=不能修改正在运行的测试
|
||||
test_not_found=测试不存在:
|
||||
test_not_running=测试未运行
|
||||
test_case_exist=\u8BE5\u9879\u76EE\u4E0B\u5DF2\u5B58\u5728\u7528\u4F8B\uFF1A
|
||||
error_lang_invalid=\u8BED\u8A00\u53C2\u6570\u9519\u8BEF
|
||||
load_test_already_exists=\u6D4B\u8BD5\u540D\u79F0\u4E0D\u80FD\u91CD\u590D
|
||||
project_name_is_null=\u9879\u76EE\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A
|
||||
project_name_already_exists=\u9879\u76EE\u540D\u79F0\u5DF2\u5B58\u5728
|
||||
workspace_name_is_null=\u5DE5\u4F5C\u7A7A\u95F4\u540D\u4E0D\u80FD\u4E3A\u7A7A
|
||||
workspace_name_already_exists=\u5DE5\u4F5C\u7A7A\u95F4\u540D\u5DF2\u5B58\u5728
|
||||
workspace_does_not_belong_to_user=\u5F53\u524D\u5DE5\u4F5C\u7A7A\u95F4\u4E0D\u5C5E\u4E8E\u5F53\u524D\u7528\u6237
|
||||
organization_does_not_belong_to_user=\u5F53\u524D\u7EC4\u7EC7\u4E0D\u5C5E\u4E8E\u5F53\u524D\u7528\u6237
|
||||
file_cannot_be_null=\u6587\u4EF6\u4E0D\u80FD\u4E3A\u7A7A\uFF01
|
||||
edit_load_test_not_found=\u65E0\u6CD5\u7F16\u8F91\u6D4B\u8BD5\uFF0C\u672A\u627E\u5230\u6D4B\u8BD5\uFF1A
|
||||
run_load_test_not_found=\u65E0\u6CD5\u8FD0\u884C\u6D4B\u8BD5\uFF0C\u672A\u627E\u5230\u6D4B\u8BD5\uFF1A
|
||||
run_load_test_file_not_found=\u65E0\u6CD5\u8FD0\u884C\u6D4B\u8BD5\uFF0C\u65E0\u6CD5\u83B7\u53D6\u6D4B\u8BD5\u6587\u4EF6\u5143\u4FE1\u606F\uFF0C\u6D4B\u8BD5ID\uFF1A
|
||||
run_load_test_file_content_not_found=\u65E0\u6CD5\u8FD0\u884C\u6D4B\u8BD5\uFF0C\u65E0\u6CD5\u83B7\u53D6\u6D4B\u8BD5\u6587\u4EF6\u5185\u5BB9\uFF0C\u6D4B\u8BD5ID\uFF1A
|
||||
run_load_test_file_init_error=\u65E0\u6CD5\u8FD0\u884C\u6D4B\u8BD5\uFF0C\u521D\u59CB\u5316\u8FD0\u884C\u73AF\u5883\u5931\u8D25\uFF0C\u6D4B\u8BD5ID\uFF1A
|
||||
load_test_is_running=\u6D4B\u8BD5\u6B63\u5728\u8FD0\u884C, \u8BF7\u7B49\u5F85
|
||||
node_deep_limit=\u8282\u70B9\u6DF1\u5EA6\u4E0D\u8D85\u8FC75\u5C42\uFF01
|
||||
no_nodes_message=\u6CA1\u6709\u8282\u70B9\u4FE1\u606F
|
||||
duplicate_node_ip=\u8282\u70B9 IP \u91CD\u590D
|
||||
only_one_k8s=\u53EA\u80FD\u6DFB\u52A0\u4E00\u4E2A K8s
|
||||
organization_id_is_null=\u7EC4\u7EC7 ID \u4E0D\u80FD\u4E3A\u7A7A
|
||||
max_thread_insufficient=\u5E76\u53D1\u7528\u6237\u6570\u8D85\u989D
|
||||
cannot_edit_load_test_running=\u4E0D\u80FD\u4FEE\u6539\u6B63\u5728\u8FD0\u884C\u7684\u6D4B\u8BD5
|
||||
test_not_found=\u6D4B\u8BD5\u4E0D\u5B58\u5728:
|
||||
test_not_running=\u6D4B\u8BD5\u672A\u8FD0\u884C
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere;
|
||||
|
||||
import io.metersphere.config.KafkaProperties;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -22,6 +23,7 @@ import javax.xml.transform.stream.StreamResult;
|
|||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
|
@ -47,7 +49,7 @@ public class JmxFileParseTest {
|
|||
@Test
|
||||
public void parse() throws Exception {
|
||||
File file = new File("/Users/liuruibin/Downloads/blaze_meter_dev2.jmx");
|
||||
file = new File("/Users/liuruibin/Desktop/test-jmeter.jmx");
|
||||
file = new File("/Users/liuruibin/Desktop/041301.jmx");
|
||||
|
||||
final FileInputStream inputStream = new FileInputStream(file);
|
||||
final InputSource inputSource = new InputSource(inputStream);
|
||||
|
@ -78,7 +80,8 @@ public class JmxFileParseTest {
|
|||
TransformerFactory tf = TransformerFactory.newInstance();
|
||||
Transformer transformer = tf.newTransformer();
|
||||
transformer.transform(domSource, result);
|
||||
System.out.println("XML IN String format is: \n" + writer.toString());
|
||||
// System.out.println("XML IN String format is: \n" + writer.toString());
|
||||
FileUtils.writeStringToFile(new File("/tmp/test-jmeter.jmx"), writer.toString(), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private void parseHashTree(Element hashTree) {
|
||||
|
@ -112,13 +115,13 @@ public class JmxFileParseTest {
|
|||
} else if (nodeNameEquals(ele, VARIABLE_THROUGHPUT_TIMER)) {
|
||||
|
||||
} else if (nodeNameEquals(ele, BACKEND_LISTENER)) {
|
||||
processBackendListener(ele);
|
||||
// processBackendListener(ele);
|
||||
} else if (nodeNameEquals(ele, CONFIG_TEST_ELEMENT)) {
|
||||
processConfigTestElement(ele);
|
||||
// processConfigTestElement(ele);
|
||||
} else if (nodeNameEquals(ele, DNS_CACHE_MANAGER)) {
|
||||
processDnsCacheManager(ele);
|
||||
// processDnsCacheManager(ele);
|
||||
} else if (nodeNameEquals(ele, ARGUMENTS)) {
|
||||
processArguments(ele);
|
||||
// processArguments(ele);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,13 +14,14 @@
|
|||
"@fortawesome/vue-fontawesome": "^0.1.9",
|
||||
"axios": "^0.19.0",
|
||||
"core-js": "^3.4.3",
|
||||
"echarts": "^4.6.0",
|
||||
"element-ui": "^2.13.0",
|
||||
"vue": "^2.6.10",
|
||||
"vue-echarts": "^4.1.0",
|
||||
"vue-i18n": "^8.15.3",
|
||||
"vue-router": "^3.1.3",
|
||||
"vuex": "^3.1.2",
|
||||
"echarts": "^4.6.0",
|
||||
"vue-echarts": "^4.1.0"
|
||||
"vuedraggable": "^2.23.2",
|
||||
"vuex": "^3.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^4.1.0",
|
||||
|
@ -42,7 +43,7 @@
|
|||
],
|
||||
"rules": {
|
||||
"vue/no-unused-components": "off",
|
||||
"no-console":"off",
|
||||
"no-console": "off",
|
||||
"no-unused-vars": "off"
|
||||
},
|
||||
"parserOptions": {
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<template>
|
||||
<span>
|
||||
<slot name="front"></slot>
|
||||
<ms-table-operator-button :tip="$t('commons.edit')" icon="el-icon-edit" @exec="editClick" @click.stop="editClickStop"/>
|
||||
<slot name="middle"></slot>
|
||||
<ms-table-operator-button :tip="$t('commons.delete')" icon="el-icon-delete" type="danger" @exec="deleteClick" @click.stop="deleteClickStop"/>
|
||||
<slot name="behind"></slot>
|
||||
</span>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsTableOperatorButton from "./MsTableOperatorButton";
|
||||
export default {
|
||||
name: "MsTableOperator",
|
||||
components: {MsTableOperatorButton},
|
||||
methods: {
|
||||
editClick() {
|
||||
this.$emit('editClick');
|
||||
},
|
||||
editClickStop() {
|
||||
this.$emit('editClickStop');
|
||||
},
|
||||
deleteClick() {
|
||||
this.$emit('deleteClick');
|
||||
},
|
||||
deleteClickStop() {
|
||||
this.$emit('deleteClickStop');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,40 @@
|
|||
<template>
|
||||
<ms-tip-button @click="exec"
|
||||
@clickStop="clickStop"
|
||||
:type="type"
|
||||
:tip="tip"
|
||||
:icon="icon" size="mini" circle/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsTableButton from "./MsTableButton";
|
||||
import MsTipButton from "./MsTipButton";
|
||||
export default {
|
||||
name: "MsTableOperatorButton",
|
||||
components: {MsTipButton, MsTableButton},
|
||||
props: {
|
||||
icon: {
|
||||
type: String,
|
||||
default: 'el-icon-question'
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'primary'
|
||||
},
|
||||
tip: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
exec() {
|
||||
this.$emit('exec');
|
||||
},
|
||||
clickStop() {
|
||||
this.$emit('clickStop');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
|
@ -5,6 +5,7 @@
|
|||
placement="bottom"
|
||||
:effect="effect">
|
||||
<el-button @click="exec()"
|
||||
@click.stop="clickStop"
|
||||
circle
|
||||
:type="type"
|
||||
:icon="icon"
|
||||
|
@ -42,6 +43,9 @@
|
|||
methods: {
|
||||
exec() {
|
||||
this.$emit('click');
|
||||
},
|
||||
clickStop() {
|
||||
this.$emit('clickStop');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import PerformanceReportView from "../../performance/report/PerformanceReportVie
|
|||
import ApiReportView from "../../api/report/ApiReportView";
|
||||
import TrackHome from "../../track/home/TrackHome";
|
||||
import TestPlan from "../../track/plan/TestPlan";
|
||||
import TestPlanView from "../../track/plan/TestPlanView";
|
||||
import TestPlanView from "../../track/plan/view/TestPlanView";
|
||||
import TestCase from "../../track/case/TestCase";
|
||||
import TestTrack from "../../track/TestTrack";
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@
|
|||
});
|
||||
break;
|
||||
case 'Starting':
|
||||
case 'Reporting':
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: "报告生成中...."
|
||||
|
|
|
@ -53,6 +53,9 @@
|
|||
<el-tag size="mini" type="success" v-else-if="row.status === 'Running'">
|
||||
{{ row.status }}
|
||||
</el-tag>
|
||||
<el-tag size="mini" type="warning" v-else-if="row.status === 'Reporting'">
|
||||
{{ row.status }}
|
||||
</el-tag>
|
||||
<el-tag size="mini" type="info" v-else-if="row.status === 'Completed'">
|
||||
{{ row.status }}
|
||||
</el-tag>
|
||||
|
|
|
@ -55,6 +55,9 @@
|
|||
<el-tag size="mini" type="success" v-else-if="row.status === 'Running'">
|
||||
{{ row.status }}
|
||||
</el-tag>
|
||||
<el-tag size="mini" type="warning" v-else-if="row.status === 'Reporting'">
|
||||
{{ row.status }}
|
||||
</el-tag>
|
||||
<el-tag size="mini" type="info" v-else-if="row.status === 'Completed'">
|
||||
{{ row.status }}
|
||||
</el-tag>
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
<el-table-column prop="workspaceName" label="所属工作空间"/>
|
||||
<el-table-column>
|
||||
<template v-slot:default="scope">
|
||||
<el-button @click="edit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
|
||||
<el-button @click="del(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
|
||||
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -48,10 +47,11 @@
|
|||
import {TokenKey} from "../../../common/js/constants";
|
||||
import MsTablePagination from "../common/pagination/TablePagination";
|
||||
import MsTableHeader from "../common/components/MsTableHeader";
|
||||
import MsTableOperator from "../common/components/MsTableOperator";
|
||||
|
||||
export default {
|
||||
name: "MsProject",
|
||||
components: {MsCreateBox, MsTablePagination, MsTableHeader},
|
||||
components: {MsTableOperator, MsCreateBox, MsTablePagination, MsTableHeader},
|
||||
data() {
|
||||
return {
|
||||
createVisible: false,
|
||||
|
|
|
@ -46,19 +46,10 @@
|
|||
|
||||
<!-- dialog of workspace member -->
|
||||
<el-dialog :visible.sync="memberVisible" width="70%" :destroy-on-close="true" @close="closeMemberFunc">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="member-title">{{$t('commons.member')}}
|
||||
<ms-create-box :tips="addTips" :exec="addMember" v-permission="['admin','org_admin']"/>
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small"
|
||||
:placeholder="$t('organization.search_by_name')"
|
||||
prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition.name" clearable/>
|
||||
</span>
|
||||
</el-row>
|
||||
<ms-table-header :condition.sync="dialogCondition" @create="addMember"
|
||||
:create-tip="dialogBtnTips" :title="$t('commons.member')"/>
|
||||
<!-- organization member table -->
|
||||
<el-table :data="memberLineData" style="width: 100%">
|
||||
<el-table :data="memberLineData" style="width: 100%;margin-top: 5px;">
|
||||
<el-table-column prop="name" :label="$t('commons.username')"/>
|
||||
<el-table-column prop="email" :label="$t('commons.email')"/>
|
||||
<el-table-column prop="phone" :label="$t('commons.phone')"/>
|
||||
|
@ -394,9 +385,11 @@
|
|||
result: {},
|
||||
loading: false,
|
||||
createVisible: false,
|
||||
btnTips: this.$t('workspace.add'),
|
||||
btnTips: this.$t('workspace.create'),
|
||||
dialogBtnTips: this.$t('member.create'),
|
||||
addTips: this.$t('member.create'),
|
||||
condition: {},
|
||||
dialogCondition: {},
|
||||
items: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
|
|
|
@ -31,19 +31,10 @@
|
|||
</el-card>
|
||||
<!-- dialog of organization member -->
|
||||
<el-dialog :visible.sync="memberVisible" width="70%" :destroy-on-close="true" @close="closeMemberFunc">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="member-title">{{$t('commons.member')}}
|
||||
<ms-create-box :tips="btnTips" :exec="addMember"/>
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small"
|
||||
:placeholder="$t('organization.search_by_name')"
|
||||
prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition.name" clearable/>
|
||||
</span>
|
||||
</el-row>
|
||||
<ms-table-header :condition.sync="dialogCondition" @create="addMember"
|
||||
:create-tip="dialogBtnTips" :title="$t('commons.member')"/>
|
||||
<!-- organization member table -->
|
||||
<el-table :data="memberLineData" style="width: 100%">
|
||||
<el-table :data="memberLineData" style="width: 100%;margin-top:5px;">
|
||||
<el-table-column prop="name" :label="$t('commons.username')"/>
|
||||
<el-table-column prop="email" :label="$t('commons.email')"/>
|
||||
<el-table-column prop="phone" :label="$t('commons.phone')"/>
|
||||
|
@ -214,8 +205,10 @@
|
|||
pageMemberSize: 5,
|
||||
memberTotal: 0,
|
||||
currentRow: {},
|
||||
btnTips: this.$t('member.create'),
|
||||
btnTips: this.$t('organization.create'),
|
||||
dialogBtnTips: this.$t('member.create'),
|
||||
condition: {},
|
||||
dialogCondition: {},
|
||||
tableData: [],
|
||||
memberLineData: [],
|
||||
form: {},
|
||||
|
|
|
@ -87,19 +87,10 @@
|
|||
|
||||
<!-- dialog of workspace member -->
|
||||
<el-dialog :visible.sync="memberVisible" width="70%" :destroy-on-close="true" @close="closeMemberFunc">
|
||||
<el-row type="flex" justify="space-between" align="middle">
|
||||
<span class="member-title">{{$t('commons.member')}}
|
||||
<ms-create-box :tips="addTips" :exec="addMember"/>
|
||||
</span>
|
||||
<span class="search">
|
||||
<el-input type="text" size="small"
|
||||
:placeholder="$t('organization.search_by_name')"
|
||||
prefix-icon="el-icon-search"
|
||||
maxlength="60" v-model="condition.name" clearable/>
|
||||
</span>
|
||||
</el-row>
|
||||
<ms-table-header :condition.sync="dialogCondition" @create="addMember"
|
||||
:create-tip="dialogBtnTips" :title="$t('commons.member')"/>
|
||||
<!-- organization member table -->
|
||||
<el-table :data="memberLineData" style="width: 100%">
|
||||
<el-table :data="memberLineData" style="width: 100%;margin-top: 5px;">
|
||||
<el-table-column prop="name" :label="$t('commons.username')"/>
|
||||
<el-table-column prop="email" :label="$t('commons.email')"/>
|
||||
<el-table-column prop="phone" :label="$t('commons.phone')"/>
|
||||
|
@ -437,9 +428,11 @@
|
|||
memberVisible: false,
|
||||
addMemberVisible: false,
|
||||
updateMemberVisible: false,
|
||||
btnTips: this.$t('workspace.add'),
|
||||
btnTips: this.$t('workspace.create'),
|
||||
dialogBtnTips: this.$t('member.create'),
|
||||
addTips: this.$t('member.create'),
|
||||
condition: {},
|
||||
dialogCondition: {},
|
||||
items: [],
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
return {
|
||||
result: {},
|
||||
form: {},
|
||||
btnTips: "添加工作空间成员",
|
||||
btnTips: this.$t('member.create'),
|
||||
createVisible: false,
|
||||
updateVisible: false,
|
||||
queryPath: "/user/ws/member/list",
|
||||
|
|
|
@ -22,8 +22,9 @@
|
|||
:current-project="currentProject"
|
||||
:selectNodeIds="selectNodeIds"
|
||||
:selectNodeNames="selectNodeNames"
|
||||
@openTestCaseEditDialog="openTestCaseEditDialog"
|
||||
@testCaseEdit="openTestCaseEditDialog"
|
||||
@testCaseEdit="editTestCase"
|
||||
@testCaseCopy="copyTestCase"
|
||||
@testCaseDetail="showTestCaseDetail"
|
||||
@refresh="refresh"
|
||||
ref="testCaseList">
|
||||
</test-case-list>
|
||||
|
@ -32,6 +33,7 @@
|
|||
|
||||
<test-case-edit
|
||||
@refresh="refresh"
|
||||
:read-only="testCaseReadOnly"
|
||||
:tree-nodes="treeNodes"
|
||||
ref="testCaseEditDialog">
|
||||
</test-case-edit>
|
||||
|
@ -60,7 +62,8 @@
|
|||
currentProject: null,
|
||||
treeNodes: [],
|
||||
selectNodeIds: [],
|
||||
selectNodeNames: []
|
||||
selectNodeNames: [],
|
||||
testCaseReadOnly: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -136,7 +139,19 @@
|
|||
refreshTable() {
|
||||
this.$refs.testCaseList.initTableData();
|
||||
},
|
||||
openTestCaseEditDialog(testCase) {
|
||||
editTestCase(testCase) {
|
||||
this.testCaseReadOnly = false;
|
||||
this.$refs.testCaseEditDialog.open(testCase);
|
||||
},
|
||||
copyTestCase(testCase) {
|
||||
this.testCaseReadOnly = false;
|
||||
let item = {};
|
||||
Object.assign(item, testCase);
|
||||
item.name = '';
|
||||
this.$refs.testCaseEditDialog.open(item);
|
||||
},
|
||||
showTestCaseDetail(testCase) {
|
||||
this.testCaseReadOnly = true;
|
||||
this.$refs.testCaseEditDialog.open(testCase);
|
||||
},
|
||||
getProjectByCaseId(caseId) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<div>
|
||||
|
||||
<el-dialog :title="$t('test_track.case.create')" :visible.sync="dialogFormVisible" width="65%">
|
||||
<el-dialog :title="operationType == 'edit' ? $t('test_track.case.edit_case') : $t('test_track.case.create')" :visible.sync="dialogFormVisible" width="65%">
|
||||
|
||||
<el-form :model="form" :rules="rules" ref="caseFrom">
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
:label="$t('test_track.case.name')"
|
||||
:label-width="formLabelWidth"
|
||||
prop="name">
|
||||
<el-input v-model="form.name"></el-input>
|
||||
<el-input :disabled="readOnly" v-model="form.name"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
|||
<el-form-item :label="$t('test_track.case.module')" :label-width="formLabelWidth" prop="module">
|
||||
<el-select
|
||||
v-model="form.module"
|
||||
:disabled="readOnly"
|
||||
:placeholder="$t('test_track.case.input_module')"
|
||||
filterable>
|
||||
<el-option
|
||||
|
@ -37,7 +38,7 @@
|
|||
<el-row>
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-form-item :label="$t('test_track.case.maintainer')" :label-width="formLabelWidth" prop="maintainer">
|
||||
<el-select v-model="form.maintainer" :placeholder="$t('test_track.case.input_maintainer')" filterable>
|
||||
<el-select :disabled="readOnly" v-model="form.maintainer" :placeholder="$t('test_track.case.input_maintainer')" filterable>
|
||||
<el-option
|
||||
v-for="item in maintainerOptions"
|
||||
:key="item.id"
|
||||
|
@ -49,7 +50,7 @@
|
|||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('test_track.case.priority')" :label-width="formLabelWidth" prop="priority">
|
||||
<el-select v-model="form.priority" clearable :placeholder="$t('test_track.case.input_priority')">
|
||||
<el-select :disabled="readOnly" v-model="form.priority" clearable :placeholder="$t('test_track.case.input_priority')">
|
||||
<el-option label="P0" value="P0"></el-option>
|
||||
<el-option label="P1" value="P1"></el-option>
|
||||
<el-option label="P2" value="P2"></el-option>
|
||||
|
@ -62,7 +63,7 @@
|
|||
<el-row>
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-form-item :label="$t('test_track.case.type')" :label-width="formLabelWidth" prop="type">
|
||||
<el-select v-model="form.type" :placeholder="$t('test_track.case.input_type')">
|
||||
<el-select :disabled="readOnly" v-model="form.type" :placeholder="$t('test_track.case.input_type')">
|
||||
<el-option :label="$t('commons.functional')" value="functional"></el-option>
|
||||
<el-option :label="$t('commons.performance')" value="performance"></el-option>
|
||||
<el-option :label="$t('commons.api')" value="api"></el-option>
|
||||
|
@ -71,7 +72,7 @@
|
|||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('test_track.case.method')" :label-width="formLabelWidth" prop="method">
|
||||
<el-select v-model="form.method" :placeholder="$t('test_track.case.input_method')">
|
||||
<el-select :disabled="readOnly" v-model="form.method" :placeholder="$t('test_track.case.input_method')">
|
||||
<el-option :label="$t('test_track.case.manual')" value="manual"></el-option>
|
||||
<el-option :label="$t('test_track.case.auto')" value="auto"></el-option>
|
||||
</el-select>
|
||||
|
@ -85,7 +86,7 @@
|
|||
<el-row type="flex" justify="center" style="margin-top: 10px;">
|
||||
<el-col :span="20">
|
||||
<el-form-item>
|
||||
<el-input v-model="form.prerequisite"
|
||||
<el-input :disabled="readOnly" v-model="form.prerequisite"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 4}"
|
||||
:rows="2"
|
||||
|
@ -111,6 +112,7 @@
|
|||
<template v-slot:default="scope">
|
||||
<el-input
|
||||
size="mini"
|
||||
v-if="!readOnly"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
v-model="scope.row.desc"
|
||||
|
@ -123,6 +125,7 @@
|
|||
<template v-slot:default="scope">
|
||||
<el-input
|
||||
size="mini"
|
||||
v-if="!readOnly"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
v-model="scope.row.result"
|
||||
|
@ -135,6 +138,7 @@
|
|||
<template v-slot:default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="readOnly"
|
||||
icon="el-icon-plus"
|
||||
circle size="mini"
|
||||
@click="handleAddStep(scope.$index, scope.row)"></el-button>
|
||||
|
@ -143,7 +147,7 @@
|
|||
icon="el-icon-delete"
|
||||
circle size="mini"
|
||||
@click="handleDeleteStep(scope.$index, scope.row)"
|
||||
:disabled="scope.$index == 0 ? true : false"></el-button>
|
||||
:disabled="readOnly || scope.$index == 0 ? true : false"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -159,6 +163,7 @@
|
|||
<el-input v-model="form.remark"
|
||||
:autosize="{ minRows: 2, maxRows: 4}"
|
||||
type="textarea"
|
||||
:disabled="readOnly"
|
||||
:rows="2"
|
||||
:placeholder="$t('commons.input_content')"></el-input>
|
||||
</el-form-item>
|
||||
|
@ -167,7 +172,7 @@
|
|||
</el-form>
|
||||
|
||||
<template v-slot:footer>
|
||||
<ms-dialog-footer
|
||||
<ms-dialog-footer v-if="!readOnly"
|
||||
@cancel="dialogFormVisible = false"
|
||||
@confirm="saveCase"/>
|
||||
</template>
|
||||
|
@ -227,6 +232,10 @@
|
|||
props: {
|
||||
treeNodes: {
|
||||
type: Array
|
||||
},
|
||||
readOnly: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -237,6 +246,10 @@
|
|||
if(testCase){
|
||||
//修改
|
||||
this.operationType = 'edit';
|
||||
//复制
|
||||
if (testCase.name === '') {
|
||||
this.operationType = 'add';
|
||||
}
|
||||
let tmp = {};
|
||||
Object.assign(tmp, testCase);
|
||||
tmp.steps = JSON.parse(testCase.steps);
|
||||
|
@ -319,22 +332,26 @@
|
|||
}
|
||||
},
|
||||
resetForm() {
|
||||
//防止点击修改后,点击新建触发校验
|
||||
if (this.$refs['caseFrom']) {
|
||||
this.$refs['caseFrom'].resetFields();
|
||||
this.$refs['caseFrom'].validate((valid) => {
|
||||
this.$refs['caseFrom'].resetFields();
|
||||
this.form.name = '';
|
||||
this.form.module = '';
|
||||
this.form.type = '';
|
||||
this.form.method = '';
|
||||
this.form.maintainer = '';
|
||||
this.form.priority = '';
|
||||
this.form.prerequisite = '';
|
||||
this.form.remark = '';
|
||||
this.form.steps = [{
|
||||
num: 1 ,
|
||||
desc: '',
|
||||
result: ''
|
||||
}];
|
||||
return true;
|
||||
});
|
||||
}
|
||||
this.form.name = '';
|
||||
this.form.module = '';
|
||||
this.form.type = '';
|
||||
this.form.method = '';
|
||||
this.form.maintainer = '';
|
||||
this.form.priority = '';
|
||||
this.form.prerequisite = '';
|
||||
this.form.remark = '';
|
||||
this.form.steps = [{
|
||||
num: 1 ,
|
||||
desc: '',
|
||||
result: ''
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<el-card v-loading="result.loading">
|
||||
|
@ -19,6 +19,7 @@
|
|||
|
||||
<el-table
|
||||
:data="tableData"
|
||||
@row-click="showDetail"
|
||||
class="test-content">
|
||||
<el-table-column
|
||||
prop="name"
|
||||
|
@ -60,14 +61,7 @@
|
|||
:label="$t('test_track.case.module')"
|
||||
show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="createTime"
|
||||
sortable
|
||||
:label="$t('commons.create_time')">
|
||||
<template v-slot:default="scope">
|
||||
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="updateTime"
|
||||
sortable
|
||||
|
@ -79,8 +73,12 @@
|
|||
<el-table-column
|
||||
:label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<el-button @click="handleEdit(scope.row)" type="primary" icon="el-icon-edit" size="mini" circle/>
|
||||
<el-button @click="handleDelete(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
|
||||
<ms-table-operator @editClick="handleEdit(scope.row)" @deleteClick="handleDelete(scope.row)">
|
||||
<template v-slot:middle>
|
||||
<ms-table-operator-button :tip="$t('commons.copy')" icon="el-icon-document-copy"
|
||||
type="success" @exec="handleCopy(scope.row)"/>
|
||||
</template>
|
||||
</ms-table-operator>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -103,10 +101,14 @@
|
|||
import PriorityTableItem from "../../common/TableItems/PriorityTableItem";
|
||||
import TypeTableItem from "../../common/TableItems/TypeTableItem";
|
||||
import MethodTableItem from "../../common/TableItems/MethodTableItem";
|
||||
import MsTableOperator from "../../../common/components/MsTableOperator";
|
||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||
|
||||
export default {
|
||||
name: "TestCaseList",
|
||||
components: {
|
||||
MsTableOperatorButton,
|
||||
MsTableOperator,
|
||||
MethodTableItem,
|
||||
TypeTableItem,
|
||||
PriorityTableItem,
|
||||
|
@ -177,11 +179,14 @@
|
|||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
},
|
||||
testCaseCreate() {
|
||||
this.$emit('openTestCaseEditDialog');
|
||||
this.$emit('testCaseEdit');
|
||||
},
|
||||
handleEdit(testCase) {
|
||||
this.$emit('testCaseEdit', testCase);
|
||||
},
|
||||
handleCopy(testCase) {
|
||||
this.$emit('testCaseCopy', testCase);
|
||||
},
|
||||
handleDelete(testCase) {
|
||||
this.$alert(this.$t('test_track.case.delete_confirm') + testCase.name + "?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
|
@ -209,6 +214,9 @@
|
|||
filter(value, row, column) {
|
||||
const property = column['property'];
|
||||
return row[property] === value;
|
||||
},
|
||||
showDetail(row, event, column) {
|
||||
this.$emit('testCaseDetail', row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,4 +244,8 @@
|
|||
width: 240px;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -63,12 +63,7 @@
|
|||
<el-table-column
|
||||
:label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<el-button @click="handleEdit(scope.row)"
|
||||
@click.stop="deleteVisible = true" type="primary"
|
||||
icon="el-icon-edit" size="mini" circle/>
|
||||
<el-button @click="handleDelete(scope.row)"
|
||||
@click.stop="deleteVisible = true" type="danger"
|
||||
icon="el-icon-delete" size="mini" circle/>
|
||||
<ms-table-operator @editClick="handleEdit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -85,10 +80,13 @@
|
|||
import MsCreateBox from '../../../settings/CreateBox';
|
||||
import MsTablePagination from '../../../../components/common/pagination/TablePagination';
|
||||
import MsTableHeader from "../../../common/components/MsTableHeader";
|
||||
import MsDialogFooter from "../../../common/components/MsDialogFooter";
|
||||
import MsTableOperatorButton from "../../../common/components/MsTableOperatorButton";
|
||||
import MsTableOperator from "../../../common/components/MsTableOperator";
|
||||
|
||||
export default {
|
||||
name: "TestPlanList",
|
||||
components: {MsTableHeader, MsCreateBox, MsTablePagination},
|
||||
components: {MsTableOperator, MsTableOperatorButton, MsDialogFooter, MsTableHeader, MsCreateBox, MsTablePagination},
|
||||
data() {
|
||||
return {
|
||||
result: {},
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
|
||||
<script>
|
||||
|
||||
import NodeTree from "../common/NodeTree";
|
||||
import TestPlanTestCaseList from "./components/TestPlanTestCaseList";
|
||||
import TestCaseRelevance from "./components/TestCaseRelevance";
|
||||
import SelectMenu from "../common/SelectMenu";
|
||||
import NodeTree from "../../common/NodeTree";
|
||||
import TestPlanTestCaseList from "./comonents/TestPlanTestCaseList";
|
||||
import TestCaseRelevance from "./comonents/TestCaseRelevance";
|
||||
import SelectMenu from "../../common/SelectMenu";
|
||||
|
||||
export default {
|
||||
name: "TestPlanView",
|
|
@ -20,8 +20,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {WORKSPACE_ID} from '../../../../../common/js/constants'
|
||||
import MsDialogFooter from '../../../common/components/MsDialogFooter'
|
||||
import {WORKSPACE_ID} from '../../../../../../common/js/constants'
|
||||
import MsDialogFooter from '../../../../common/components/MsDialogFooter'
|
||||
|
||||
export default {
|
||||
name: "executorEdit",
|
|
@ -19,8 +19,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import TestPlanTestCaseStatusButton from '../common/TestPlanTestCaseStatusButton';
|
||||
import MsDialogFooter from '../../../common/components/MsDialogFooter'
|
||||
import TestPlanTestCaseStatusButton from '../../common/TestPlanTestCaseStatusButton';
|
||||
import MsDialogFooter from '../../../../common/components/MsDialogFooter'
|
||||
|
||||
export default {
|
||||
name: "statusEdit",
|
|
@ -54,8 +54,8 @@
|
|||
|
||||
<script>
|
||||
|
||||
import NodeTree from '../../common/NodeTree';
|
||||
import MsDialogFooter from '../../../common/components/MsDialogFooter'
|
||||
import NodeTree from '../../../common/NodeTree';
|
||||
import MsDialogFooter from '../../../../common/components/MsDialogFooter'
|
||||
|
||||
export default {
|
||||
name: "TestCaseRelevance",
|
|
@ -165,7 +165,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import TestPlanTestCaseStatusButton from '../common/TestPlanTestCaseStatusButton';
|
||||
import TestPlanTestCaseStatusButton from '../../common/TestPlanTestCaseStatusButton';
|
||||
|
||||
export default {
|
||||
name: "TestPlanTestCaseEdit",
|
|
@ -89,8 +89,7 @@
|
|||
<el-table-column
|
||||
:label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<el-button @click="handleEdit(scope.row, scope.$index)" type="primary" icon="el-icon-edit" size="mini" circle/>
|
||||
<el-button @click="handleDelete(scope.row)" type="danger" icon="el-icon-unlock" size="mini" circle/>
|
||||
<ms-table-operator @editClick="handleEdit(scope.row, scope.$index)" @deleteClick="handleDelete(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -109,23 +108,25 @@
|
|||
<script>
|
||||
import ExecutorEdit from './ExecutorEdit';
|
||||
import StatusEdit from './StatusEdit';
|
||||
import TestPlanTestCaseEdit from "../components/TestPlanTestCaseEdit";
|
||||
import MsTipButton from '../../../../components/common/components/MsTipButton';
|
||||
import MsTablePagination from '../../../../components/common/pagination/TablePagination';
|
||||
import MsTableHeader from '../../../../components/common/components/MsTableHeader';
|
||||
import MsTableButton from '../../../../components/common/components/MsTableButton';
|
||||
import NodeBreadcrumb from '../../common/NodeBreadcrumb';
|
||||
import TestPlanTestCaseEdit from "./TestPlanTestCaseEdit";
|
||||
import MsTipButton from '../../../../common/components/MsTipButton';
|
||||
import MsTablePagination from '../../../../common/pagination/TablePagination';
|
||||
import MsTableHeader from '../../../../common/components/MsTableHeader';
|
||||
import MsTableButton from '../../../../common/components/MsTableButton';
|
||||
import NodeBreadcrumb from '../../../common/NodeBreadcrumb';
|
||||
|
||||
import {TokenKey} from '../../../../../common/js/constants';
|
||||
import {tableFilter} from '../../../../../common/js/utils';
|
||||
import PriorityTableItem from "../../common/TableItems/PriorityTableItem";
|
||||
import StatusTableItem from "../../common/TableItems/StatusTableItem";
|
||||
import TypeTableItem from "../../common/TableItems/TypeTableItem";
|
||||
import MethodTableItem from "../../common/TableItems/MethodTableItem";
|
||||
import {TokenKey} from '../../../../../../common/js/constants';
|
||||
import {tableFilter} from '../../../../../../common/js/utils';
|
||||
import PriorityTableItem from "../../../common/TableItems/PriorityTableItem";
|
||||
import StatusTableItem from "../../../common/TableItems/StatusTableItem";
|
||||
import TypeTableItem from "../../../common/TableItems/TypeTableItem";
|
||||
import MethodTableItem from "../../../common/TableItems/MethodTableItem";
|
||||
import MsTableOperator from "../../../../common/components/MsTableOperator";
|
||||
|
||||
export default {
|
||||
name: "TestPlanTestCaseList",
|
||||
components: {
|
||||
MsTableOperator,
|
||||
MethodTableItem,
|
||||
TypeTableItem,
|
||||
StatusTableItem,
|
|
@ -43,6 +43,8 @@ export default {
|
|||
'functional': 'Functional test',
|
||||
'input_content': 'Please enter content',
|
||||
'create': 'Create',
|
||||
'edit': 'Edit',
|
||||
'copy': 'Copy',
|
||||
'refresh': 'Refresh',
|
||||
'remark': 'Remark',
|
||||
'delete': 'Delete',
|
||||
|
@ -186,6 +188,7 @@ export default {
|
|||
test_case: "Test Case",
|
||||
case_list: "Test Case List",
|
||||
create_case: "Create Case",
|
||||
eitd_case: "Eidt Case",
|
||||
no_project: "There is no project in this workspace, please create the project first",
|
||||
priority: "Priority",
|
||||
type: "Type",
|
||||
|
@ -222,10 +225,11 @@ export default {
|
|||
upload_limit_size: "Upload file size cannot exceed 20MB!",
|
||||
success: "Import success!",
|
||||
},
|
||||
|
||||
export: {
|
||||
export: "Export cases"
|
||||
}
|
||||
},},
|
||||
},
|
||||
plan: {
|
||||
test_plan: "Test Plan",
|
||||
create_plan: "Create test plan",
|
||||
|
@ -247,7 +251,6 @@ export default {
|
|||
plan_status_running: "Starting",
|
||||
plan_status_completed: "Completed",
|
||||
plan_delete_confirm: "Confirm delete test plan: ",
|
||||
|
||||
},
|
||||
module: {
|
||||
search: "Search module",
|
||||
|
@ -279,7 +282,7 @@ export default {
|
|||
select_execute_result: "Select execute result",
|
||||
confirm_cancel_relevance: "Confirm cancel relevance",
|
||||
select_manipulate: "Select the data you want to manipulate",
|
||||
|
||||
}
|
||||
},
|
||||
test_resource_pool: {
|
||||
'type': 'type',
|
||||
|
|
|
@ -44,6 +44,8 @@ export default {
|
|||
'functional': '功能测试',
|
||||
'input_content': '请输入内容',
|
||||
'create': '新建',
|
||||
'edit': '编辑',
|
||||
'copy': '复制',
|
||||
'refresh': '刷新',
|
||||
'remark': '备注',
|
||||
'delete': '删除',
|
||||
|
@ -231,6 +233,7 @@ export default {
|
|||
test_case: "测试用例",
|
||||
case_list: "用例列表",
|
||||
create_case: "创建用例",
|
||||
edit_case: "编辑用例",
|
||||
no_project: "该工作空间下无项目,请先创建项目",
|
||||
priority: "优先级",
|
||||
type: "类型",
|
||||
|
|
Loading…
Reference in New Issue