Merge remote-tracking branch 'origin/master'

This commit is contained in:
song.tianyang 2021-03-22 11:45:48 +08:00
commit 248f6ef850
30 changed files with 1268 additions and 438 deletions

View File

@ -247,26 +247,22 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
NoticeSendService noticeSendService = CommonBeanFactory.getBean(NoticeSendService.class);
assert systemParameterService != null;
assert noticeSendService != null;
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
String url = reportUrl;
String url2 = reportUrl;
if (StringUtils.isEmpty(url)) {
url = baseSystemConfigDTO.getUrl() + "/#/api/report/view/" + report.getId();
url2 = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + report.getId();
}
String url = baseSystemConfigDTO.getUrl() + "/#/api/report/view/" + report.getId();
String url2 = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + report.getId();
String successContext = "";
String failedContext = "";
String subject = "";
String event = "";
if (StringUtils.equals(ReportTriggerMode.API.name(), report.getTriggerMode())) {
successContext = "接口测试 API任务通知:'" + report.getName() + "'执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
failedContext = "接口测试 API任务通知:'" + report.getName() + "'执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
successContext = "接口测试 API任务通知:'" + report.getName() + "'执行成功" + "\n" + "【接口定义暂无报告链接】" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "(旧版)接口测)路径" + url + "\n" + "新版接口测试路径" + url2;
failedContext = "接口测试 API任务通知:'" + report.getName() + "'执行失败" + "\n" + "【接口定义暂无报告链接】" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
subject = Translator.get("task_notification_jenkins");
}
if (StringUtils.equals(ReportTriggerMode.SCHEDULE.name(), report.getTriggerMode())) {
successContext = "接口测试定时任务通知:'" + report.getName() + "'执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
failedContext = "接口测试定时任务通知:'" + report.getName() + "'执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
successContext = "接口测试定时任务通知:'" + report.getName() + "'执行成功" + "\n" + "【接口定义暂无报告链接】" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
failedContext = "接口测试定时任务通知:'" + report.getName() + "'执行失败" + "\n" + "【接口定义暂无报告链接】" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
subject = Translator.get("task_notification");
}
if (StringUtils.equals("Success", report.getStatus())) {

View File

@ -0,0 +1,18 @@
package io.metersphere.base.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class TestCaseTest implements Serializable {
private String id;
private String testCaseId;
private String testId;
private String testType;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,480 @@
package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class TestCaseTestExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public TestCaseTestExample() {
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(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTestCaseIdIsNull() {
addCriterion("test_case_id is null");
return (Criteria) this;
}
public Criteria andTestCaseIdIsNotNull() {
addCriterion("test_case_id is not null");
return (Criteria) this;
}
public Criteria andTestCaseIdEqualTo(String value) {
addCriterion("test_case_id =", value, "testCaseId");
return (Criteria) this;
}
public Criteria andTestCaseIdNotEqualTo(String value) {
addCriterion("test_case_id <>", value, "testCaseId");
return (Criteria) this;
}
public Criteria andTestCaseIdGreaterThan(String value) {
addCriterion("test_case_id >", value, "testCaseId");
return (Criteria) this;
}
public Criteria andTestCaseIdGreaterThanOrEqualTo(String value) {
addCriterion("test_case_id >=", value, "testCaseId");
return (Criteria) this;
}
public Criteria andTestCaseIdLessThan(String value) {
addCriterion("test_case_id <", value, "testCaseId");
return (Criteria) this;
}
public Criteria andTestCaseIdLessThanOrEqualTo(String value) {
addCriterion("test_case_id <=", value, "testCaseId");
return (Criteria) this;
}
public Criteria andTestCaseIdLike(String value) {
addCriterion("test_case_id like", value, "testCaseId");
return (Criteria) this;
}
public Criteria andTestCaseIdNotLike(String value) {
addCriterion("test_case_id not like", value, "testCaseId");
return (Criteria) this;
}
public Criteria andTestCaseIdIn(List<String> values) {
addCriterion("test_case_id in", values, "testCaseId");
return (Criteria) this;
}
public Criteria andTestCaseIdNotIn(List<String> values) {
addCriterion("test_case_id not in", values, "testCaseId");
return (Criteria) this;
}
public Criteria andTestCaseIdBetween(String value1, String value2) {
addCriterion("test_case_id between", value1, value2, "testCaseId");
return (Criteria) this;
}
public Criteria andTestCaseIdNotBetween(String value1, String value2) {
addCriterion("test_case_id not between", value1, value2, "testCaseId");
return (Criteria) this;
}
public Criteria andTestIdIsNull() {
addCriterion("test_id is null");
return (Criteria) this;
}
public Criteria andTestIdIsNotNull() {
addCriterion("test_id is not null");
return (Criteria) this;
}
public Criteria andTestIdEqualTo(String value) {
addCriterion("test_id =", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotEqualTo(String value) {
addCriterion("test_id <>", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThan(String value) {
addCriterion("test_id >", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThanOrEqualTo(String value) {
addCriterion("test_id >=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThan(String value) {
addCriterion("test_id <", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThanOrEqualTo(String value) {
addCriterion("test_id <=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLike(String value) {
addCriterion("test_id like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotLike(String value) {
addCriterion("test_id not like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdIn(List<String> values) {
addCriterion("test_id in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotIn(List<String> values) {
addCriterion("test_id not in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdBetween(String value1, String value2) {
addCriterion("test_id between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotBetween(String value1, String value2) {
addCriterion("test_id not between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andTestTypeIsNull() {
addCriterion("test_type is null");
return (Criteria) this;
}
public Criteria andTestTypeIsNotNull() {
addCriterion("test_type is not null");
return (Criteria) this;
}
public Criteria andTestTypeEqualTo(String value) {
addCriterion("test_type =", value, "testType");
return (Criteria) this;
}
public Criteria andTestTypeNotEqualTo(String value) {
addCriterion("test_type <>", value, "testType");
return (Criteria) this;
}
public Criteria andTestTypeGreaterThan(String value) {
addCriterion("test_type >", value, "testType");
return (Criteria) this;
}
public Criteria andTestTypeGreaterThanOrEqualTo(String value) {
addCriterion("test_type >=", value, "testType");
return (Criteria) this;
}
public Criteria andTestTypeLessThan(String value) {
addCriterion("test_type <", value, "testType");
return (Criteria) this;
}
public Criteria andTestTypeLessThanOrEqualTo(String value) {
addCriterion("test_type <=", value, "testType");
return (Criteria) this;
}
public Criteria andTestTypeLike(String value) {
addCriterion("test_type like", value, "testType");
return (Criteria) this;
}
public Criteria andTestTypeNotLike(String value) {
addCriterion("test_type not like", value, "testType");
return (Criteria) this;
}
public Criteria andTestTypeIn(List<String> values) {
addCriterion("test_type in", values, "testType");
return (Criteria) this;
}
public Criteria andTestTypeNotIn(List<String> values) {
addCriterion("test_type not in", values, "testType");
return (Criteria) this;
}
public Criteria andTestTypeBetween(String value1, String value2) {
addCriterion("test_type between", value1, value2, "testType");
return (Criteria) this;
}
public Criteria andTestTypeNotBetween(String value1, String value2) {
addCriterion("test_type not between", value1, value2, "testType");
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);
}
}
}

View File

@ -2,18 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.TestCaseReviewScenarioMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCaseReviewScenario">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="test_case_review_id" jdbcType="VARCHAR" property="testCaseReviewId"/>
<result column="api_scenario_id" jdbcType="VARCHAR" property="apiScenarioId"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
<result column="pass_rate" jdbcType="VARCHAR" property="passRate"/>
<result column="last_result" jdbcType="VARCHAR" property="lastResult"/>
<result column="report_id" jdbcType="VARCHAR" property="reportId"/>
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="test_case_review_id" jdbcType="VARCHAR" property="testCaseReviewId"/>
<result column="api_scenario_id" jdbcType="VARCHAR" property="apiScenarioId"/>
<result column="status" jdbcType="VARCHAR" property="status"/>
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
<result column="pass_rate" jdbcType="VARCHAR" property="passRate"/>
<result column="last_result" jdbcType="VARCHAR" property="lastResult"/>
<result column="report_id" jdbcType="VARCHAR" property="reportId"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseReviewScenario">
<result column="environment" jdbcType="LONGVARCHAR" property="environment"/>
<result column="environment" jdbcType="LONGVARCHAR" property="environment"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -80,46 +80,46 @@
<sql id="Blob_Column_List">
environment
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.TestCaseReviewScenarioExample"
resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from test_case_review_scenario
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.TestCaseReviewScenarioExample"
resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from test_case_review_scenario
<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.TestCaseReviewScenarioExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from test_case_review_scenario
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseReviewScenarioExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from test_case_review_scenario
<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.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from test_case_review_scenario
where id = #{id,jdbcType=VARCHAR}
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from test_case_review_scenario
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from test_case_review_scenario
where id = #{id,jdbcType=VARCHAR}
@ -131,14 +131,14 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseReviewScenario">
insert into test_case_review_scenario (id, test_case_review_id, api_scenario_id,
`status`, create_time, update_time,
pass_rate, last_result, report_id,
environment)
values (#{id,jdbcType=VARCHAR}, #{testCaseReviewId,jdbcType=VARCHAR}, #{apiScenarioId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
#{environment,jdbcType=LONGVARCHAR})
insert into test_case_review_scenario (id, test_case_review_id, api_scenario_id,
`status`, create_time, update_time,
pass_rate, last_result, report_id,
environment)
values (#{id,jdbcType=VARCHAR}, #{testCaseReviewId,jdbcType=VARCHAR}, #{apiScenarioId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
#{environment,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReviewScenario">
insert into test_case_review_scenario
@ -248,37 +248,37 @@
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update test_case_review_scenario
set id = #{record.id,jdbcType=VARCHAR},
test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR},
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
pass_rate = #{record.passRate,jdbcType=VARCHAR},
last_result = #{record.lastResult,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
environment = #{record.environment,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
update test_case_review_scenario
set id = #{record.id,jdbcType=VARCHAR},
test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR},
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
pass_rate = #{record.passRate,jdbcType=VARCHAR},
last_result = #{record.lastResult,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
environment = #{record.environment,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_case_review_scenario
set id = #{record.id,jdbcType=VARCHAR},
test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR},
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
pass_rate = #{record.passRate,jdbcType=VARCHAR},
last_result = #{record.lastResult,jdbcType=VARCHAR},
update test_case_review_scenario
set id = #{record.id,jdbcType=VARCHAR},
test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR},
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
pass_rate = #{record.passRate,jdbcType=VARCHAR},
last_result = #{record.lastResult,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR}
<if test="_parameter != null">
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
@ -316,28 +316,28 @@
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestCaseReviewScenario">
update test_case_review_scenario
set test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR},
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
pass_rate = #{passRate,jdbcType=VARCHAR},
last_result = #{lastResult,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
environment = #{environment,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
update test_case_review_scenario
set test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR},
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
pass_rate = #{passRate,jdbcType=VARCHAR},
last_result = #{lastResult,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
environment = #{environment,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseReviewScenario">
update test_case_review_scenario
set test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR},
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
pass_rate = #{passRate,jdbcType=VARCHAR},
last_result = #{lastResult,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
update test_case_review_scenario
set test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR},
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
pass_rate = #{passRate,jdbcType=VARCHAR},
last_result = #{lastResult,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -0,0 +1,31 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.TestCaseTest;
import io.metersphere.base.domain.TestCaseTestExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TestCaseTestMapper {
long countByExample(TestCaseTestExample example);
int deleteByExample(TestCaseTestExample example);
int deleteByPrimaryKey(String id);
int insert(TestCaseTest record);
int insertSelective(TestCaseTest record);
List<TestCaseTest> selectByExample(TestCaseTestExample example);
TestCaseTest selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example);
int updateByExample(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example);
int updateByPrimaryKeySelective(TestCaseTest record);
int updateByPrimaryKey(TestCaseTest record);
}

View File

@ -0,0 +1,201 @@
<?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.TestCaseTestMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCaseTest">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="test_case_id" jdbcType="VARCHAR" property="testCaseId"/>
<result column="test_id" jdbcType="VARCHAR" property="testId"/>
<result column="test_type" jdbcType="VARCHAR" property="testType"/>
</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, test_case_id, test_id, test_type
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample"
resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from test_case_test
<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.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from test_case_test
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete
from test_case_test
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample">
delete from test_case_test
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseTest">
insert into test_case_test (id, test_case_id, test_id,
test_type)
values (#{id,jdbcType=VARCHAR}, #{testCaseId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
#{testType,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseTest">
insert into test_case_test
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="testCaseId != null">
test_case_id,
</if>
<if test="testId != null">
test_id,
</if>
<if test="testType != null">
test_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="testCaseId != null">
#{testCaseId,jdbcType=VARCHAR},
</if>
<if test="testId != null">
#{testId,jdbcType=VARCHAR},
</if>
<if test="testType != null">
#{testType,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseTestExample"
resultType="java.lang.Long">
select count(*) from test_case_test
<if test="_parameter != null">
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update test_case_test
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.testCaseId != null">
test_case_id = #{record.testCaseId,jdbcType=VARCHAR},
</if>
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR},
</if>
<if test="record.testType != null">
test_type = #{record.testType,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_case_test
set id = #{record.id,jdbcType=VARCHAR},
test_case_id = #{record.testCaseId,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
test_type = #{record.testType,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestCaseTest">
update test_case_test
<set>
<if test="testCaseId != null">
test_case_id = #{testCaseId,jdbcType=VARCHAR},
</if>
<if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR},
</if>
<if test="testType != null">
test_type = #{testType,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseTest">
update test_case_test
set test_case_id = #{testCaseId,jdbcType=VARCHAR},
test_id = #{testId,jdbcType=VARCHAR},
test_type = #{testType,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -140,20 +140,20 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlan">
insert into test_plan (id, workspace_id, report_id,
`name`, description, `status`,
stage, principal, test_case_match_rule,
executor_match_rule, create_time, update_time,
actual_end_time, planned_start_time, planned_end_time,
actual_start_time, creator, project_id,
execution_times, tags)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
#{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
#{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{executionTimes,jdbcType=INTEGER}, #{tags,jdbcType=LONGVARCHAR})
insert into test_plan (id, workspace_id, report_id,
`name`, description, `status`,
stage, principal, test_case_match_rule,
executor_match_rule, create_time, update_time,
actual_end_time, planned_start_time, planned_end_time,
actual_start_time, creator, project_id,
execution_times, tags)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
#{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
#{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{executionTimes,jdbcType=INTEGER}, #{tags,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlan">
insert into test_plan
@ -357,8 +357,8 @@
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update test_plan
set id = #{record.id,jdbcType=VARCHAR},
update test_plan
set id = #{record.id,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
@ -366,44 +366,44 @@
`status` = #{record.status,jdbcType=VARCHAR},
stage = #{record.stage,jdbcType=VARCHAR},
principal = #{record.principal,jdbcType=VARCHAR},
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
creator = #{record.creator,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
execution_times = #{record.executionTimes,jdbcType=INTEGER},
tags = #{record.tags,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
creator = #{record.creator,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
execution_times = #{record.executionTimes,jdbcType=INTEGER},
tags = #{record.tags,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_plan
set id = #{record.id,jdbcType=VARCHAR},
update test_plan
set id = #{record.id,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
stage = #{record.stage,jdbcType=VARCHAR},
principal = #{record.principal,jdbcType=VARCHAR},
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
creator = #{record.creator,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
execution_times = #{record.executionTimes,jdbcType=INTEGER}
<if test="_parameter != null">
principal = #{record.principal,jdbcType=VARCHAR},
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
creator = #{record.creator,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
execution_times = #{record.executionTimes,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
@ -471,48 +471,48 @@
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestPlan">
update test_plan
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER},
tags = #{tags,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
update test_plan
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER},
tags = #{tags,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlan">
update test_plan
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
update test_plan
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -51,7 +51,6 @@ public class SystemParameterController {
}
@GetMapping("/base/info")
@RequiresRoles(value = {RoleConstants.ADMIN})
public BaseSystemConfigDTO getBaseInfo () {
return SystemParameterService.getBaseInfo();
}

View File

@ -16,4 +16,5 @@ public class EditTestCaseRequest extends TestCaseWithBLOBs {
* 复制测试用例后要进行复制的文件Id list
*/
private List<String> fileIds = new ArrayList<>();
private List<List<String>> selected = new ArrayList<>();
}

View File

@ -30,6 +30,7 @@ import io.metersphere.track.request.testcase.QueryTestCaseRequest;
import io.metersphere.track.request.testcase.TestCaseBatchRequest;
import io.metersphere.track.request.testcase.TestCaseMinderEditRequest;
import io.metersphere.xmind.XmindCaseParser;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType;
@ -37,7 +38,6 @@ import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
@ -88,6 +88,8 @@ public class TestCaseService {
FileService fileService;
@Resource
TestCaseFileMapper testCaseFileMapper;
@Resource
TestCaseTestMapper testCaseTestMapper;
public TestCaseWithBLOBs addTestCase(TestCaseWithBLOBs testCase) {
testCase.setName(testCase.getName());
@ -181,6 +183,9 @@ public class TestCaseService {
testPlanTestCaseMapper.deleteByExample(example);
testCaseIssueService.delTestCaseIssues(testCaseId);
testCaseCommentService.deleteCaseComment(testCaseId);
TestCaseTestExample examples = new TestCaseTestExample();
examples.createCriteria().andTestCaseIdEqualTo(testCaseId);
testCaseTestMapper.deleteByExample(examples);
return testCaseMapper.deleteByPrimaryKey(testCaseId);
}
@ -652,7 +657,18 @@ public class TestCaseService {
}
final TestCaseWithBLOBs testCaseWithBLOBs = addTestCase(request);
//插入测试与用例关系表
if (!CollectionUtils.isEmpty(request.getSelected())) {
List<List<String>> selecteds = request.getSelected();
TestCaseTest test = new TestCaseTest();
selecteds.forEach(id -> {
test.setTestType(id.get(0));
test.setTestId(id.get(1));
test.setId(UUID.randomUUID().toString());
test.setTestCaseId(request.getId());
testCaseTestMapper.insert(test);
});
}
// 复制用例时传入文件ID进行复制
if (!CollectionUtils.isEmpty(request.getFileIds())) {
List<String> fileIds = request.getFileIds();
@ -665,6 +681,7 @@ public class TestCaseService {
});
}
files.forEach(file -> {
final FileMetadata fileMetadata = fileService.saveFile(file, testCaseWithBLOBs.getProjectId());
TestCaseFile testCaseFile = new TestCaseFile();
@ -680,7 +697,21 @@ public class TestCaseService {
if (testCaseWithBLOBs == null) {
MSException.throwException(Translator.get("edit_load_test_not_found") + request.getId());
}
//插入测试与用例关系表
if (!CollectionUtils.isEmpty(request.getSelected())) {
TestCaseTestExample example = new TestCaseTestExample();
example.createCriteria().andTestCaseIdEqualTo(request.getId());
testCaseTestMapper.deleteByExample(example);
List<List<String>> selecteds = request.getSelected();
TestCaseTest test = new TestCaseTest();
selecteds.forEach(id -> {
test.setTestType(id.get(0));
test.setTestId(id.get(1));
test.setId(UUID.randomUUID().toString());
test.setTestCaseId(request.getId());
testCaseTestMapper.insert(test);
});
}
// 新选择了一个文件删除原来的文件
List<FileMetadata> updatedFiles = request.getUpdatedFileList();
List<FileMetadata> originFiles = fileService.getFileMetadataByCaseId(request.getId());

View File

@ -126,6 +126,8 @@ public class TestPlanService {
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
@Resource
private ApiScenarioMapper apiScenarioMapper;
@Resource
private TestCaseTestMapper testCaseTestMapper;
public synchronized String addTestPlan(AddTestPlanRequest testPlan) {
if (getTestPlanByName(testPlan.getName()).size() > 0) {
@ -433,57 +435,65 @@ public class TestPlanService {
if(request.getChecked()){
if (!testCaseIds.isEmpty()) {
testCaseIds.forEach(caseId -> {
TestCaseWithBLOBs testDtail=testCaseMapper.selectByPrimaryKey(caseId);
if(StringUtils.equals(testDtail.getType(),TestCaseStatus.performance.name())){
TestPlanLoadCase t = new TestPlanLoadCase();
t.setId(UUID.randomUUID().toString());
t.setTestPlanId(request.getPlanId());
t.setLoadCaseId(testDtail.getTestId());
t.setCreateTime(System.currentTimeMillis());
t.setUpdateTime(System.currentTimeMillis());
TestPlanLoadCaseExample testPlanLoadCaseExample=new TestPlanLoadCaseExample();
testPlanLoadCaseExample.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andLoadCaseIdEqualTo(t.getLoadCaseId());
if (testPlanLoadCaseMapper.countByExample(testPlanLoadCaseExample) <=0) {
testPlanLoadCaseMapper.insert(t);
List<TestCaseTest> list=new ArrayList<>();
TestCaseTestExample examp=new TestCaseTestExample();
examp.createCriteria().andTestCaseIdEqualTo(caseId);
if(testCaseTestMapper.countByExample(examp)>0){
list=testCaseTestMapper.selectByExample(examp);
}
list.forEach(l->{
if(StringUtils.equals(l.getTestType(),TestCaseStatus.performance.name())){
TestPlanLoadCase t = new TestPlanLoadCase();
t.setId(UUID.randomUUID().toString());
t.setTestPlanId(request.getPlanId());
t.setLoadCaseId(l.getTestId());
t.setCreateTime(System.currentTimeMillis());
t.setUpdateTime(System.currentTimeMillis());
TestPlanLoadCaseExample testPlanLoadCaseExample=new TestPlanLoadCaseExample();
testPlanLoadCaseExample.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andLoadCaseIdEqualTo(t.getLoadCaseId());
if (testPlanLoadCaseMapper.countByExample(testPlanLoadCaseExample) <=0) {
testPlanLoadCaseMapper.insert(t);
}
}
if(StringUtils.equals(l.getTestType(),TestCaseStatus.testcase.name())){
TestPlanApiCase t=new TestPlanApiCase();
ApiTestCaseWithBLOBs apitest=apiTestCaseMapper.selectByPrimaryKey(l.getTestId());
ApiDefinitionWithBLOBs apidefinition=apiDefinitionMapper.selectByPrimaryKey(apitest.getApiDefinitionId());
t.setId(UUID.randomUUID().toString());
t.setTestPlanId(request.getPlanId());
t.setApiCaseId(l.getTestId());
t.setEnvironmentId(apidefinition.getEnvironmentId());
t.setCreateTime(System.currentTimeMillis());
t.setUpdateTime(System.currentTimeMillis());
TestPlanApiCaseExample example=new TestPlanApiCaseExample();
example.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andApiCaseIdEqualTo(t.getApiCaseId());
if(testPlanApiCaseMapper.countByExample(example)<=0){
testPlanApiCaseMapper.insert(t);
}
}
if(StringUtils.equals(testDtail.getType(),TestCaseStatus.testcase.name())){
TestPlanApiCase t=new TestPlanApiCase();
ApiTestCaseWithBLOBs apitest=apiTestCaseMapper.selectByPrimaryKey(testDtail.getTestId());
ApiDefinitionWithBLOBs apidefinition=apiDefinitionMapper.selectByPrimaryKey(apitest.getApiDefinitionId());
t.setId(UUID.randomUUID().toString());
t.setTestPlanId(request.getPlanId());
t.setApiCaseId(testDtail.getTestId());
t.setEnvironmentId(apidefinition.getEnvironmentId());
t.setCreateTime(System.currentTimeMillis());
t.setUpdateTime(System.currentTimeMillis());
TestPlanApiCaseExample example=new TestPlanApiCaseExample();
example.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andApiCaseIdEqualTo(t.getApiCaseId());
if(testPlanApiCaseMapper.countByExample(example)<=0){
testPlanApiCaseMapper.insert(t);
}
if(StringUtils.equals(l.getTestType(),TestCaseStatus.automation.name())){
TestPlanApiScenario t=new TestPlanApiScenario();
ApiScenarioWithBLOBs testPlanApiScenario=apiScenarioMapper.selectByPrimaryKey(l.getTestId());
t.setId(UUID.randomUUID().toString());
t.setTestPlanId(request.getPlanId());
t.setApiScenarioId(l.getTestId());
t.setLastResult(testPlanApiScenario.getLastResult());
t.setPassRate(testPlanApiScenario.getPassRate());
t.setReportId(testPlanApiScenario.getReportId());
t.setStatus(testPlanApiScenario.getStatus());
t.setCreateTime(System.currentTimeMillis());
t.setUpdateTime(System.currentTimeMillis());
TestPlanApiScenarioExample example=new TestPlanApiScenarioExample();
example.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andApiScenarioIdEqualTo(t.getApiScenarioId());
if(testPlanApiScenarioMapper.countByExample(example)<=0){
testPlanApiScenarioMapper.insert(t);
}
}
if(StringUtils.equals(testDtail.getType(),TestCaseStatus.automation.name())){
TestPlanApiScenario t=new TestPlanApiScenario();
ApiScenarioWithBLOBs testPlanApiScenario=apiScenarioMapper.selectByPrimaryKey(testDtail.getTestId());
t.setId(UUID.randomUUID().toString());
t.setTestPlanId(request.getPlanId());
t.setApiScenarioId(testDtail.getTestId());
t.setLastResult(testPlanApiScenario.getLastResult());
t.setPassRate(testPlanApiScenario.getPassRate());
t.setReportId(testPlanApiScenario.getReportId());
t.setStatus(testPlanApiScenario.getStatus());
t.setCreateTime(System.currentTimeMillis());
t.setUpdateTime(System.currentTimeMillis());
TestPlanApiScenarioExample example=new TestPlanApiScenarioExample();
example.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andApiScenarioIdEqualTo(t.getApiScenarioId());
if(testPlanApiScenarioMapper.countByExample(example)<=0){
testPlanApiScenarioMapper.insert(t);
}
}
});
}
});
}

View File

@ -162,18 +162,32 @@ SET file_metadata.project_id = temp.project_id;
CREATE TABLE IF NOT EXISTS `esb_api_params`
(
id varchar(50) not null,
resource_id varchar(50),
data_struct LONGTEXT null,
fronted_script LONGTEXT null,
response_data_struct LONGTEXT null,
backed_script LONGTEXT null,
id varchar(50) not null,
resource_id varchar(50),
data_struct LONGTEXT null,
fronted_script LONGTEXT null,
response_data_struct LONGTEXT null,
backed_script LONGTEXT null,
primary key (id),
UNIQUE KEY `resource_id` ( `resource_id` )
UNIQUE KEY `resource_id` (`resource_id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
-- add execution_times testPlan
alter table test_plan
add execution_times int null;
alter table test_case modify method varchar(15) null comment 'Test case method type';
alter table test_case
modify method varchar(15) null comment 'Test case method type';
-- add test_case_test
create table test_case_test
(
id varchar(70) null,
test_case_id varchar(70) null,
test_id varchar(70) null,
test_type varchar(70) null,
constraint test_case_test_pk
primary key (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4;
alter table test_case
modify test_id varchar(2000) null;

View File

@ -76,6 +76,7 @@
<table tableName="test_case_review_load"/>
<table tableName="test_case_review_scenario"/>
<table tableName="test_plan"/>
<table tableName="test_case_test"/>
</context>
</generatorConfiguration>

View File

@ -11,11 +11,15 @@
<p style="margin-left: 60px">您好:
</div>
<div style="margin-left: 100px">
successContext = "接口测试定时任务通知:'" + report.getName() + "'执行成功" + "\n" + "【接口定义暂无报告链接】"+"\n" +"请点击下面链接进入测试报告页面" +
"\n" + "(旧版)接口测试路径" + url + "\n" + "(新版)接口测试路径" + url2;
<p>您所执行的 ${testName} 接口测试运行失败<br/>
请点击下面链接进入测试报告页面</p>
请点击下面链接进入测试报告页面【接口定义暂无报告路径】<br/>
【旧版接口测试报告路径】</p>
<a href="${url}/#/${type}/report/view/${id}">${url}/#/${type}/report/view/${id}</a>
<p>新版接口测试报告路径</p>
<a href="${url}/#/api/automation">${url}/#/api/automation</a>
<p>新版接口测试报告路径</p>
<a href="${url}/#/api/automation/report/view/${id}">${url}/#/api/automation/report/view/${id}</a>
</div>
</div>

View File

@ -11,10 +11,11 @@
</div>
<div style="margin-left: 100px">
<p>您所执行的 ${testName} 接口测试运行成功<br/>
请点击下面链接进入测试报告页面</p>
请点击下面链接进入测试报告页面【接口定义暂无报告路径】<br/>
【旧版接口测试报告路径】</p>
<a href="${url}/#/${type}/report/view/${id}">${url}/#/${type}/report/view/${id}</a>
<p>新版接口测试报告路径</p>
<a href="${url}/#/api/automation">${url}/#/api/automation</a>
<p>新版接口测试报告路径</p>
<a href="${url}/#/api/automation/report/view/${id}">${url}/#/api/automation/report/view/${id}</a>
</div>
</body>
</html>

View File

@ -244,7 +244,7 @@
return {
type: API_SCENARIO_LIST,
headerItems: Api_Scenario_List,
tableLabel: Api_Scenario_List,
tableLabel: [],
loading: false,
screenHeight: document.documentElement.clientHeight - 280,//,
condition: {
@ -361,6 +361,7 @@
},
methods: {
customHeader() {
getLabel(this, API_SCENARIO_LIST);
this.$refs.headerCustom.open(this.tableLabel)
},
selectByParam() {
@ -369,7 +370,6 @@
},
search(projectId) {
this.selectRows = new Set();
getLabel(this, API_SCENARIO_LIST);
this.condition.moduleIds = this.selectNodeIds;
if (this.trashEnable) {
this.condition.filters = {status: ["Trash"]};
@ -421,6 +421,7 @@
this.unSelection = data.listObject.map(s => s.id);
});
}
getLabel(this, API_SCENARIO_LIST);
},
handleCommand(cmd) {
let table = this.$refs.scenarioTable;

View File

@ -60,13 +60,13 @@
</el-table-column>
<el-table-column
v-if="item.id == 'custom'"
sortable="custom"
prop="path"
min-width="180px"
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip
:key="index"/>
v-if="item.id == 'path'"
sortable="custom"
prop="path"
min-width="180px"
:label="$t('api_test.definition.api_path')"
show-overflow-tooltip
:key="index"/>
<el-table-column v-if="item.id=='tags'" prop="tags" min-width="120px" :label="$t('commons.tag')"
:key="index">
@ -83,12 +83,12 @@
:key="index"/>
<el-table-column
v-if="item.id=='custom'"
sortable="custom"
min-width="160"
:label="$t('api_test.definition.api_last_time')"
prop="updateTime"
:key="index">
v-if="item.id=='updateTime'"
sortable="updateTime"
min-width="160"
:label="$t('api_test.definition.api_last_time')"
prop="updateTime"
:key="index">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
@ -186,7 +186,7 @@ export default {
return {
type: API_CASE_LIST,
headerItems: Api_Case_List,
tableLabel: Api_Case_List,
tableLabel: [],
condition: {
components: API_CASE_CONFIGS
},
@ -286,10 +286,11 @@ export default {
},
methods: {
customHeader() {
getLabel(this, API_CASE_LIST);
this.$refs.headerCustom.open(this.tableLabel)
},
initTable() {
getLabel(this, API_CASE_LIST);
this.selectRows = new Set();
this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds;
@ -332,6 +333,7 @@ export default {
})
});
}
getLabel(this, API_CASE_LIST);
},
open() {
this.$refs.searchBar.open();

View File

@ -272,7 +272,7 @@ export default {
return {
type: API_LIST,
headerItems: Api_List,
tableLabel: Api_List,
tableLabel: [],
condition: {
components: API_DEFINITION_CONFIGS
},
@ -392,13 +392,13 @@ export default {
},
methods: {
customHeader() {
getLabel(this, API_LIST);
this.$refs.headerCustom.open(this.tableLabel)
},
handleBatchMove() {
this.$refs.testCaseBatchMove.open(this.moduleTree, [], this.moduleOptions);
},
initTable() {
getLabel(this, API_LIST);
this.selectRows = new Set();
initCondition(this.condition);
this.selectDataCounts = 0;
@ -444,6 +444,7 @@ export default {
})
});
}
getLabel(this, API_LIST);
},
genProtocalFilter(protocalType) {
if (protocalType === "HTTP") {

View File

@ -71,6 +71,12 @@ export const API_STATUS = [
{id: 'Underway', label: '进行中'},
{id: 'Completed', label: '已完成'}
]
export const TEST = [
{id: 'performance', name: '性能测试'},
{id: 'api', name: '接口测试'},
{id: 'testcase', name: '测试用例'},
{id: 'automation', name: '场景测试'}
]
export const API_METHOD_COLOUR = [
['GET', "#61AFFE"], ['POST', '#49CC90'], ['PUT', '#fca130'],

View File

@ -46,12 +46,20 @@ export default {
return type !== 'inner';
},
open(items) {
this.defaultCheckedKeys = []
this.dialogTableVisible = true
items.forEach(i => {
this.defaultCheckedKeys.push(i.id)
}
)
/*this.optionalField = items*/
this.fieldSelected = items
if (items.size <= 0) {
this.optionalField = this.optionalFields
} else {
items.forEach(i => {
this.defaultCheckedKeys.push(i.id)
}
)
}
console.log(this.defaultCheckedKeys)
},
saveHeader() {
let param = {

View File

@ -5,12 +5,17 @@ export const Track_Test_Case = [
{id: 'num', label: i18n.t('commons.id')},
{id: 'name', label: i18n.t('commons.name')},
{id: 'priority', label: i18n.t('test_track.case.priority')},
{id: 'type', label: i18n.t('test_track.case.type')},
{id: 'method', label: i18n.t('test_track.case.method')},
/*
{id: 'type', label: i18n.t('test_track.case.type')},
*/
/*
{id: 'method', label: i18n.t('test_track.case.method')},
*/
{id: 'reviewStatus', label: i18n.t('test_track.case.status')},
{id: 'tags', label: i18n.t('commons.tag')},
{id: 'nodePath', label: i18n.t('test_track.case.module')},
{id: 'updateTime', label: i18n.t('commons.update_time')},
{id: 'status', label: i18n.t('commons.status')}
]
//用例评审-测试用例
export const Test_Case_Review = [

View File

@ -197,6 +197,7 @@ export default {
}
},
addTab(tab) {
this.projectId=getCurrentProjectID();
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
return;
@ -257,13 +258,19 @@ export default {
this.testCaseReadOnly = true;
}
let caseId = this.$route.params.caseId;
this.projectId=getCurrentProjectID();
if (!this.projectId) {
this.$warning(this.$t('commons.check_project_tip'));
return;
}
/*
this.openRecentTestCaseEditDialog(caseId);
*/
if (caseId) {
this.$get('test/case/get/' + caseId, response => {
let testCase = response.data;
this.editTestCase(testCase)
});
} else {
this.addTab({name: 'add'});
}
this.$router.push('/track/case/all');
}
},

View File

@ -99,37 +99,15 @@
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item :label="$t('test_track.case.type')" :label-width="formLabelWidth" prop="type">
<el-select @change="typeChange" :disabled="readOnly" v-model="form.type"
:placeholder="$t('test_track.case.input_type')" class="ms-case-input">
<el-option :label="$t('commons.performance')" value="performance"></el-option>
<el-option :label="$t('commons.api')" value="api"></el-option>
<el-option :label="$t('api_test.home_page.failed_case_list.table_value.case_type.api')"
value="testcase"></el-option>
<el-option :label="$t('api_test.home_page.failed_case_list.table_value.case_type.scene')"
value="automation"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth" prop="testId">
<el-cascader show-all-levels v-model="form.selected" :props="props" ></el-cascader>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item :label="$t('test_track.case.relate_test')" :label-width="formLabelWidth" prop="testId">
<el-select filterable :disabled="readOnly" v-model="form.testId"
:placeholder="$t('test_track.case.input_type')" class="ms-case-input">
<el-option
v-for="item in testOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="7" v-if="form.testId=='other'">
<!-- <el-col :span="7" v-if="form.testId=='other'">
<el-form-item :label="$t('test_track.case.test_name')" :label-width="formLabelWidth" prop="testId">
<el-input v-model="form.otherTestName" :placeholder="$t('test_track.case.input_test_case')"></el-input>
</el-form-item>
</el-col>
</el-col>-->
</el-row>
@ -146,6 +124,7 @@
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="需求名称" :label-width="formLabelWidth" prop="demandName" v-if="form.demandId=='other'">
@ -310,7 +289,6 @@
</template>
<script>
import {TokenKey, WORKSPACE_ID} from '@/common/js/constants';
import MsDialogFooter from '../../../common/components/MsDialogFooter'
import {getCurrentUser, listenGoBack, removeGoBackListener} from "@/common/js/utils";
@ -325,16 +303,59 @@ import MsPreviousNextButton from "../../../common/components/MsPreviousNextButto
import {ELEMENTS} from "@/business/components/api/automation/scenario/Setting";
import TestCaseComment from "@/business/components/track/case/components/TestCaseComment";
import ReviewCommentItem from "@/business/components/track/review/commom/ReviewCommentItem";
import {API_STATUS, REVIEW_STATUS} from "@/business/components/api/definition/model/JsonData";
import {API_STATUS, REVIEW_STATUS, TEST} from "@/business/components/api/definition/model/JsonData";
export default {
name: "TestCaseEdit",
components: {
ReviewCommentItem,
TestCaseComment, MsPreviousNextButton, MsInputTag, CaseComment, MsDialogFooter, TestCaseAttachment
},
data() {
return {
props: {
multiple: true,
lazy: true,
lazyLoad: ((node, resolve) => {
const { level } = node;
if(node.level==0){
const nodes = TEST
.map(item => ({
value: item.id,
label: item.name,
leaf: level >= 1
}));
resolve(nodes)
}
if(node.level==1){
this.projectId = getCurrentProjectID()
this.testOptions = [];
let url = '';
this.form.type=node.data.value
console.log(this.form.type)
if (this.form.type === 'testcase' || this.form.type === 'automation') {
url = '/api/' + this.form.type + '/list/' + this.projectId
} else if (this.form.type === 'performance' || this.form.type === 'api') {
url = '/' + this.form.type + '/list/' + this.projectId
}
if (this.projectId && this.form.type != '' && this.form.type != 'undefined') {
this.$get(url, response => {
response.data.unshift({id: 'other', name: this.$t('test_track.case.other')})
const nodes = response.data
.map(item => ({
value: item.id,
label: item.name,
leaf: level >= 1
}));
resolve(nodes)
});
}
}
}),
},
options: REVIEW_STATUS,
statuOptions:API_STATUS,
comments: [],
@ -356,6 +377,7 @@ export default {
desc: '',
result: ''
}],
selected:[],
remark: '',
tags: [],
demandId: '',
@ -433,6 +455,7 @@ export default {
}
},
methods: {
handleCommand(e) {
if (e === "ADD_AND_CREATE") {
this.$refs['caseFrom'].validate((valid) => {
@ -548,11 +571,16 @@ export default {
},
setFormData(testCase) {
testCase.tags = JSON.parse(testCase.tags);
testCase.selected = JSON.parse(testCase.testId);
let tmp = {};
Object.assign(tmp, testCase);
tmp.steps = JSON.parse(testCase.steps);
if (tmp.steps == null) {
tmp.steps = []
}
Object.assign(this.form, tmp);
this.form.module = testCase.nodeId;
this.form.testId=testCase.testId
this.getFileMetaData(testCase);
},
setTestCaseExtInfo(testCase) {
@ -658,8 +686,8 @@ export default {
},
buildParam() {
let param = {};
Object.assign(param, this.form);
console.log(this.form)
param.steps = JSON.stringify(this.form.steps);
param.nodeId = this.form.module;
this.moduleOptions.forEach(item => {
@ -675,7 +703,9 @@ export default {
if (this.form.tags instanceof Array) {
this.form.tags = JSON.stringify(this.form.tags);
}
param.testId=JSON.stringify(this.form.selected)
param.tags = this.form.tags;
param.type = 'functional'
return param;
},
getOption(param) {
@ -745,7 +775,8 @@ export default {
this.maintainerOptions = response.data;
});
},
getTestOptions() {
getTestOptions(val) {
console.log(val)
this.projectId = getCurrentProjectID()
this.testOptions = [];
let url = '';
@ -965,4 +996,11 @@ export default {
width: 100%;
}
/deep/ .el-button-group > .el-button:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
height: 32px;
width: 56px;
}
</style>

View File

@ -102,18 +102,31 @@
</el-table-column>-->
<el-table-column
v-if="item.id=='status'"
:filters="statusFilters"
column-key="status"
min-width="100px"
:label="$t('test_track.case.status')"
:key="index">
v-if="item.id=='reviewStatus'"
:filters="reviewStatusFilters"
column-key="reviewStatus"
min-width="100px"
:label="$t('test_track.case.status')"
:key="index">
<template v-slot:default="scope">
<span class="el-dropdown-link">
<review-status :value="scope.row.reviewStatus"/>
</span>
</template>
</el-table-column>
<el-table-column
v-if="item.id=='status'"
:filters="statusFilters"
column-key="status"
min-width="100px"
:label="$t('commons.status')"
:key="index">
<template v-slot:default="scope">
<span class="el-dropdown-link">
<plan-status-table-item :value="scope.row.status"></plan-status-table-item>
</span>
</template>
</el-table-column>
<el-table-column v-if="item.id=='tags'" prop="tags" :label="$t('commons.tag')" :key="index">
<template v-slot:default="scope">
@ -123,8 +136,8 @@
</el-table-column>
<el-table-column
v-if="item.id=='nodePath'"
prop="nodePath"
v-if="item.id=='nodePath'"
prop="nodePath"
:label="$t('test_track.case.module')"
min-width="150px"
show-overflow-tooltip
@ -213,10 +226,12 @@ import {Track_Test_Case} from "@/business/components/common/model/JsonData";
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
import i18n from "@/i18n/i18n";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import PlanStatusTableItem from "@/business/components/track/common/tableItems/plan/PlanStatusTableItem";
export default {
name: "TestCaseList",
components: {
PlanStatusTableItem,
HeaderLabelOperate,
HeaderCustom,
BatchMove,
@ -244,7 +259,7 @@ export default {
return {
type: TEST_CASE_LIST,
headerItems: Track_Test_Case,
tableLabel: Track_Test_Case,
tableLabel: [],
result: {},
deletePath: "/test/case/delete",
condition: {
@ -270,11 +285,16 @@ export default {
{text: this.$t('commons.performance'), value: 'performance'},
{text: this.$t('commons.api'), value: 'api'}
],
statusFilters: [
reviewStatusFilters: [
{text: this.$t('test_track.case.status_prepare'), value: 'Prepare'},
{text: this.$t('test_track.case.status_pass'), value: 'Pass'},
{text: this.$t('test_track.case.status_un_pass'), value: 'UnPass'},
],
statusFilters: [
{text: '未开始', value: 'Prepare'},
{text: '进行中', value: 'Underway'},
{text: '已完成', value: 'Completed'},
],
showMore: false,
buttons: [
{
@ -361,6 +381,7 @@ export default {
},
methods: {
customHeader() {
getLabel(this, TEST_CASE_LIST);
this.$refs.headerCustom.open(this.tableLabel)
},
getSelectDataRange() {

View File

@ -248,7 +248,7 @@ export default {
return {
type: TEST_PLAN_LIST,
headerItems: Test_Plan_List,
tableLabel: Test_Plan_List,
tableLabel: [],
result: {},
enableDeleteTip: false,
queryPath: "/test/plan/list",
@ -290,7 +290,6 @@ export default {
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() {
getLabel(this, TEST_PLAN_LIST);
if (this.planId) {
this.condition.planId = this.planId;
}
@ -308,9 +307,11 @@ export default {
if (item.tags && item.tags.length > 0) {
item.tags = JSON.parse(item.tags);
}
item.passRate=item.passRate+'%'
item.passRate = item.passRate + '%'
})
});
getLabel(this, TEST_PLAN_LIST);
},
copyData(status) {
return JSON.parse(JSON.stringify(this.dataMap.get(status)))

View File

@ -192,7 +192,7 @@ export default {
return {
type: TEST_PLAN_API_CASE,
headerItems: Test_Plan_Api_Case,
tableLabel: Test_Plan_Api_Case,
tableLabel: [],
condition: {},
selectCase: {},
result: {},
@ -302,6 +302,8 @@ export default {
},
methods: {
customHeader() {
getLabel(this, TEST_PLAN_API_CASE);
this.$refs.headerCustom.open(this.tableLabel)
},
getMaintainerOptions() {
@ -317,7 +319,6 @@ export default {
this.$emit('isApiListEnableChange', data);
},
initTable() {
getLabel(this, TEST_PLAN_API_CASE);
this.selectRows = new Set();
this.condition.status = "";
this.condition.moduleIds = this.selectNodeIds;
@ -356,7 +357,7 @@ export default {
})
});
}
getLabel(this, TEST_PLAN_API_CASE);
},
handleSelect(selection, row) {
row.hashTree = [];

View File

@ -148,7 +148,7 @@ export default {
return {
type: TEST_PLAN_SCENARIO_CASE,
headerItems: Test_Plan_Scenario_Case,
tableLabel: Test_Plan_Scenario_Case,
tableLabel: [],
loading: false,
condition: {},
currentScenario: {},
@ -196,10 +196,11 @@ export default {
},
methods: {
customHeader() {
getLabel(this, TEST_PLAN_SCENARIO_CASE);
this.$refs.headerCustom.open(this.tableLabel)
},
search() {
getLabel(this, TEST_PLAN_SCENARIO_CASE);
this.selectRows = new Set();
this.loading = true;
this.condition.moduleIds = this.selectNodeIds;
@ -241,6 +242,7 @@ export default {
this.loading = false;
});
}
getLabel(this, TEST_PLAN_SCENARIO_CASE);
},
reductionApi(row) {

View File

@ -312,7 +312,7 @@ export default {
return {
type: TEST_PLAN_FUNCTION_TEST_CASE,
headerItems: Test_Plan_Function_Test_Case,
tableLabel: Test_Plan_Function_Test_Case,
tableLabel: [],
result: {},
deletePath: "/test/case/delete",
condition: {
@ -416,11 +416,11 @@ export default {
},
methods: {
customHeader() {
getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE);
this.$refs.headerCustom.open(this.tableLabel)
},
initTableData() {
getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE);
if (this.planId) {
// param.planId = this.planId;
this.condition.planId = this.planId;
@ -464,6 +464,7 @@ export default {
this.selectRows.clear();
});
}
getLabel(this, TEST_PLAN_FUNCTION_TEST_CASE);
},
showDetail(row, event, column) {
this.isReadOnly = true;

View File

@ -154,7 +154,7 @@ export default {
return {
type: TEST_PLAN_LOAD_CASE,
headerItems: Test_Plan_Load_Case,
tableLabel: Test_Plan_Load_Case,
tableLabel: [],
condition: {},
result: {},
tableData: [],
@ -209,10 +209,10 @@ export default {
},
methods: {
customHeader() {
getLabel(this, TEST_PLAN_LOAD_CASE);
this.$refs.headerCustom.open(this.tableLabel)
},
initTable() {
getLabel(this, TEST_PLAN_LOAD_CASE);
this.selectRows = new Set();
this.condition.testPlanId = this.planId;
if (this.selectProjectId && this.selectProjectId !== 'root') {
@ -244,6 +244,8 @@ export default {
this.tableData = listObject;
})
}
getLabel(this, TEST_PLAN_LOAD_CASE);
},
refreshStatus() {
this.refreshScheduler = setInterval(() => {
@ -328,21 +330,14 @@ export default {
})
},
updateStatus(loadCase, status) {
if (this.planId) {
this.$post('/test/plan/load/case/update', {id: loadCase.id, status: status}, () => {
this.$post('/test/plan/edit/status/' + loadCase.testPlanId, {}, () => {
this.initTable();
});
});
}
if (this.reviewId) {
this.$post('/test/review/load/case/update', {id: loadCase.id, status: status}, () => {
this.$post('/test/plan/load/case/update', {id: loadCase.id, status: status}, () => {
this.$post('/test/plan/edit/status/' + loadCase.testPlanId, {}, () => {
this.initTable();
});
}
});
},
handleDelete(loadCase) {
this.result = this.$get('/test/review/load/case/delete/' + loadCase.id, () => {
this.result = this.$get('/test/plan/load/case/delete/' + loadCase.id, () => {
this.$success(this.$t('test_track.cancel_relevance_success'));
this.$emit('refresh');
this.initTable();

View File

@ -63,30 +63,21 @@
<div class="case_container">
<el-row>
<el-col :span="4" :offset="1">
<el-col :span="9" :offset="1">
<span class="cast_label">{{ $t('test_track.case.priority') }}</span>
<span class="cast_item">{{ testCase.priority }}</span>
</el-col>
<el-col :span="5">
<span class="cast_label">{{ $t('test_track.case.case_type') }}</span>
<span class="cast_item" v-if="testCase.type === 'automation'">
场景用例
</span>
<span class="cast_item"
v-if="testCase.type === 'performance'">{{ $t('commons.performance') }}</span>
<span class="cast_item" v-if="testCase.type === 'api'">{{ $t('commons.api') }}</span>
<span class="cast_item" v-if="testCase.type === 'testcase'">接口用例</span>
</el-col>
</el-row>
<el-row>
<el-col :offset="1">
<el-col :span="10" :offset="1">
<span class="cast_label">{{ $t('test_track.case.module') }}</span>
<span class="cast_item">{{ testCase.nodePath }}</span>
</el-col>
</el-row>
<el-row>
<el-col :offset="1">
<span class="cast_label">{{ $t('test_track.plan_view.relevance_test_case') }}</span>
<span class="cast_item">{{ testCase.prerequisite }}</span>
</el-col>
</el-row>
<el-row>
<el-col :offset="1">
<span class="cast_label">{{ $t('test_track.case.prerequisite') }}</span>
@ -94,27 +85,27 @@
</el-col>
</el-row>
<!-- <el-row>
<el-col class="test-detail" :span="20" :offset="1">
<el-tabs v-model="activeTab" type="border-card">
<el-tab-pane name="detail" :label="$t('test_track.plan_view.test_detail')">
<api-test-detail :is-read-only="true" v-if="testCase.type === 'api'"
:id="testCase.testId" ref="apiTestDetail"/>
<performance-test-detail v-if="testCase.type === 'performance'"
:is-read-only="true"
:id="testCase.testId"
ref="performanceTestDetail"/>
<api-case-item :type="mark" :api="api" :api-case="apiCase" v-if="testCase.type==='testcase'"
ref="apiCaseConfig"/>
<ms-edit-api-scenario :type="mark" v-if="testCase.type==='automation'" :currentScenario="currentScenario"
ref="autoScenarioConfig"></ms-edit-api-scenario>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>-->
<el-row>
<el-col class="test-detail" :span="20" :offset="1">
<el-tabs v-model="activeTab" type="border-card">
<el-tab-pane name="detail" :label="$t('test_track.plan_view.test_detail')">
<api-test-detail :is-read-only="true" v-if="testCase.type === 'api'"
:id="testCase.testId" ref="apiTestDetail"/>
<performance-test-detail v-if="testCase.type === 'performance'"
:is-read-only="true"
:id="testCase.testId"
ref="performanceTestDetail"/>
<api-case-item :type="mark" :api="api" :api-case="apiCase" v-if="testCase.type==='testcase'"
ref="apiCaseConfig"/>
<ms-edit-api-scenario :type="mark" v-if="testCase.type==='automation'" :currentScenario="currentScenario"
ref="autoScenarioConfig"></ms-edit-api-scenario>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
<el-row v-if="testCase.type === 'function'">
<el-col :span="20" :offset="1">
<div>
<span class="cast_label">{{ $t('test_track.case.steps') }}</span>
@ -365,7 +356,7 @@ export default {
this.testCase = item;
this.getRelatedTest();
this.getComments(item);
this.initTest();
/* this.initTest();*/
this.getFileMetaData(data);
})
@ -389,59 +380,22 @@ export default {
listenGoBack(this.handleClose);
this.initData(testCase);
this.getComments(testCase);
this.getApiTestCase(testCase);
this.getCurrentScenario(testCase)
},
getApiTestCase(testCase) {
let param = {}
param.projectId = getCurrentProjectID();
param.id = testCase.testId;
this.result = this.$post("/api/testcase/list", param, response => {
let apiCaseList = []
this.apiCaseList = response.data;
this.apiCaseList.forEach(apiCase => {
if (apiCase.tags && apiCase.tags.length > 0) {
apiCase.tags = JSON.parse(apiCase.tags);
this.$set(apiCase, 'selected', false);
}
if (Object.prototype.toString.call(apiCase.request).match(/\[object (\w+)\]/)[1].toLowerCase() != 'object') {
apiCase.request = JSON.parse(apiCase.request);
}
if (!apiCase.request.hashTree) {
apiCase.request.hashTree = [];
}
this.apiCase = apiCase
this.handleTestCase(apiCase)
})
});
},
getCurrentScenario(testCase) {
this.result = this.$get("/api/automation/getApiScenario/" + testCase.testId, response => {
this.currentScenario=response.data
});
},
handleTestCase(testCase) {
this.$get('/api/definition/get/' + testCase.apiDefinitionId, (response) => {
this.api = response.data;
});
},
initTest() {
this.$nextTick(() => {
if (this.testCase.testId && this.testCase.testId !== 'other') {
if (this.$refs.apiTestDetail && this.testCase.type === 'api') {
this.$refs.apiTestDetail.init();
} else if (this.testCase.type === 'performance') {
this.$refs.performanceTestDetail.init();
} else if (this.testCase.type === 'testcase') {
this.$refs.apiCaseConfig.active(this.api);
} else if (this.testCase.type === 'automation') {
this.$refs.autoScenarioConfig.showAll();
}
}
});
},
/* initTest() {
this.$nextTick(() => {
if (this.testCase.testId && this.testCase.testId !== 'other') {
if (this.$refs.apiTestDetail && this.testCase.type === 'api') {
this.$refs.apiTestDetail.init();
} else if (this.testCase.type === 'performance') {
this.$refs.performanceTestDetail.init();
} else if (this.testCase.type === 'testcase') {
this.$refs.apiCaseConfig.active(this.api);
} else if (this.testCase.type === 'automation') {
this.$refs.autoScenarioConfig.showAll();
}
}
});
},*/
getComments(testCase) {
let id = '';
if (testCase) {