feat(测试计划): 删除测试计划同步删除用例执行历史
This commit is contained in:
parent
77b6cee0ab
commit
d96d4fc8ac
|
@ -20,6 +20,11 @@ public class TestPlanCaseExecuteHistory implements Serializable {
|
||||||
@Size(min = 1, max = 50, message = "{test_plan_case_execute_history.test_plan_case_id.length_range}", groups = {Created.class, Updated.class})
|
@Size(min = 1, max = 50, message = "{test_plan_case_execute_history.test_plan_case_id.length_range}", groups = {Created.class, Updated.class})
|
||||||
private String testPlanCaseId;
|
private String testPlanCaseId;
|
||||||
|
|
||||||
|
@Schema(description = "测试计划id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotBlank(message = "{test_plan_case_execute_history.test_plan_id.not_blank}", groups = {Created.class})
|
||||||
|
@Size(min = 1, max = 50, message = "{test_plan_case_execute_history.test_plan_id.length_range}", groups = {Created.class, Updated.class})
|
||||||
|
private String testPlanId;
|
||||||
|
|
||||||
@Schema(description = "用例ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "用例ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotBlank(message = "{test_plan_case_execute_history.case_id.not_blank}", groups = {Created.class})
|
@NotBlank(message = "{test_plan_case_execute_history.case_id.not_blank}", groups = {Created.class})
|
||||||
@Size(min = 1, max = 50, message = "{test_plan_case_execute_history.case_id.length_range}", groups = {Created.class, Updated.class})
|
@Size(min = 1, max = 50, message = "{test_plan_case_execute_history.case_id.length_range}", groups = {Created.class, Updated.class})
|
||||||
|
@ -54,6 +59,7 @@ public class TestPlanCaseExecuteHistory implements Serializable {
|
||||||
public enum Column {
|
public enum Column {
|
||||||
id("id", "id", "VARCHAR", false),
|
id("id", "id", "VARCHAR", false),
|
||||||
testPlanCaseId("test_plan_case_id", "testPlanCaseId", "VARCHAR", false),
|
testPlanCaseId("test_plan_case_id", "testPlanCaseId", "VARCHAR", false),
|
||||||
|
testPlanId("test_plan_id", "testPlanId", "VARCHAR", false),
|
||||||
caseId("case_id", "caseId", "VARCHAR", false),
|
caseId("case_id", "caseId", "VARCHAR", false),
|
||||||
status("status", "status", "VARCHAR", true),
|
status("status", "status", "VARCHAR", true),
|
||||||
deleted("deleted", "deleted", "BIT", false),
|
deleted("deleted", "deleted", "BIT", false),
|
||||||
|
|
|
@ -244,6 +244,76 @@ public class TestPlanCaseExecuteHistoryExample {
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdIsNull() {
|
||||||
|
addCriterion("test_plan_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdIsNotNull() {
|
||||||
|
addCriterion("test_plan_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdEqualTo(String value) {
|
||||||
|
addCriterion("test_plan_id =", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdNotEqualTo(String value) {
|
||||||
|
addCriterion("test_plan_id <>", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdGreaterThan(String value) {
|
||||||
|
addCriterion("test_plan_id >", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("test_plan_id >=", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdLessThan(String value) {
|
||||||
|
addCriterion("test_plan_id <", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("test_plan_id <=", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdLike(String value) {
|
||||||
|
addCriterion("test_plan_id like", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdNotLike(String value) {
|
||||||
|
addCriterion("test_plan_id not like", value, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdIn(List<String> values) {
|
||||||
|
addCriterion("test_plan_id in", values, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdNotIn(List<String> values) {
|
||||||
|
addCriterion("test_plan_id not in", values, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdBetween(String value1, String value2) {
|
||||||
|
addCriterion("test_plan_id between", value1, value2, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andTestPlanIdNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("test_plan_id not between", value1, value2, "testPlanId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
public Criteria andCaseIdIsNull() {
|
public Criteria andCaseIdIsNull() {
|
||||||
addCriterion("case_id is null");
|
addCriterion("case_id is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<resultMap id="BaseResultMap" type="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
|
<resultMap id="BaseResultMap" type="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
|
||||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
<result column="test_plan_case_id" jdbcType="VARCHAR" property="testPlanCaseId" />
|
<result column="test_plan_case_id" jdbcType="VARCHAR" property="testPlanCaseId" />
|
||||||
|
<result column="test_plan_id" jdbcType="VARCHAR" property="testPlanId" />
|
||||||
<result column="case_id" jdbcType="VARCHAR" property="caseId" />
|
<result column="case_id" jdbcType="VARCHAR" property="caseId" />
|
||||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||||
|
@ -74,7 +75,8 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, test_plan_case_id, case_id, `status`, deleted, notifier, create_user, create_time
|
id, test_plan_case_id, test_plan_id, case_id, `status`, deleted, notifier, create_user,
|
||||||
|
create_time
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
content, steps
|
content, steps
|
||||||
|
@ -128,14 +130,14 @@
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
|
<insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
|
||||||
insert into test_plan_case_execute_history (id, test_plan_case_id, case_id,
|
insert into test_plan_case_execute_history (id, test_plan_case_id, test_plan_id,
|
||||||
`status`, deleted, notifier,
|
case_id, `status`, deleted,
|
||||||
create_user, create_time, content,
|
notifier, create_user, create_time,
|
||||||
steps)
|
content, steps)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{testPlanCaseId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{testPlanCaseId,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR},
|
||||||
#{status,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}, #{notifier,jdbcType=VARCHAR},
|
#{caseId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT},
|
||||||
#{createUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARBINARY},
|
#{notifier,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||||
#{steps,jdbcType=LONGVARBINARY})
|
#{content,jdbcType=LONGVARBINARY}, #{steps,jdbcType=LONGVARBINARY})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
|
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
|
||||||
insert into test_plan_case_execute_history
|
insert into test_plan_case_execute_history
|
||||||
|
@ -146,6 +148,9 @@
|
||||||
<if test="testPlanCaseId != null">
|
<if test="testPlanCaseId != null">
|
||||||
test_plan_case_id,
|
test_plan_case_id,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="testPlanId != null">
|
||||||
|
test_plan_id,
|
||||||
|
</if>
|
||||||
<if test="caseId != null">
|
<if test="caseId != null">
|
||||||
case_id,
|
case_id,
|
||||||
</if>
|
</if>
|
||||||
|
@ -178,6 +183,9 @@
|
||||||
<if test="testPlanCaseId != null">
|
<if test="testPlanCaseId != null">
|
||||||
#{testPlanCaseId,jdbcType=VARCHAR},
|
#{testPlanCaseId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="testPlanId != null">
|
||||||
|
#{testPlanId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="caseId != null">
|
<if test="caseId != null">
|
||||||
#{caseId,jdbcType=VARCHAR},
|
#{caseId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -219,6 +227,9 @@
|
||||||
<if test="record.testPlanCaseId != null">
|
<if test="record.testPlanCaseId != null">
|
||||||
test_plan_case_id = #{record.testPlanCaseId,jdbcType=VARCHAR},
|
test_plan_case_id = #{record.testPlanCaseId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.testPlanId != null">
|
||||||
|
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="record.caseId != null">
|
<if test="record.caseId != null">
|
||||||
case_id = #{record.caseId,jdbcType=VARCHAR},
|
case_id = #{record.caseId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -252,6 +263,7 @@
|
||||||
update test_plan_case_execute_history
|
update test_plan_case_execute_history
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
test_plan_case_id = #{record.testPlanCaseId,jdbcType=VARCHAR},
|
test_plan_case_id = #{record.testPlanCaseId,jdbcType=VARCHAR},
|
||||||
|
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||||
case_id = #{record.caseId,jdbcType=VARCHAR},
|
case_id = #{record.caseId,jdbcType=VARCHAR},
|
||||||
`status` = #{record.status,jdbcType=VARCHAR},
|
`status` = #{record.status,jdbcType=VARCHAR},
|
||||||
deleted = #{record.deleted,jdbcType=BIT},
|
deleted = #{record.deleted,jdbcType=BIT},
|
||||||
|
@ -268,6 +280,7 @@
|
||||||
update test_plan_case_execute_history
|
update test_plan_case_execute_history
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
test_plan_case_id = #{record.testPlanCaseId,jdbcType=VARCHAR},
|
test_plan_case_id = #{record.testPlanCaseId,jdbcType=VARCHAR},
|
||||||
|
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
|
||||||
case_id = #{record.caseId,jdbcType=VARCHAR},
|
case_id = #{record.caseId,jdbcType=VARCHAR},
|
||||||
`status` = #{record.status,jdbcType=VARCHAR},
|
`status` = #{record.status,jdbcType=VARCHAR},
|
||||||
deleted = #{record.deleted,jdbcType=BIT},
|
deleted = #{record.deleted,jdbcType=BIT},
|
||||||
|
@ -284,6 +297,9 @@
|
||||||
<if test="testPlanCaseId != null">
|
<if test="testPlanCaseId != null">
|
||||||
test_plan_case_id = #{testPlanCaseId,jdbcType=VARCHAR},
|
test_plan_case_id = #{testPlanCaseId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="testPlanId != null">
|
||||||
|
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="caseId != null">
|
<if test="caseId != null">
|
||||||
case_id = #{caseId,jdbcType=VARCHAR},
|
case_id = #{caseId,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
@ -314,6 +330,7 @@
|
||||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
|
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
|
||||||
update test_plan_case_execute_history
|
update test_plan_case_execute_history
|
||||||
set test_plan_case_id = #{testPlanCaseId,jdbcType=VARCHAR},
|
set test_plan_case_id = #{testPlanCaseId,jdbcType=VARCHAR},
|
||||||
|
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||||
case_id = #{caseId,jdbcType=VARCHAR},
|
case_id = #{caseId,jdbcType=VARCHAR},
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
deleted = #{deleted,jdbcType=BIT},
|
deleted = #{deleted,jdbcType=BIT},
|
||||||
|
@ -327,6 +344,7 @@
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.plan.domain.TestPlanCaseExecuteHistory">
|
||||||
update test_plan_case_execute_history
|
update test_plan_case_execute_history
|
||||||
set test_plan_case_id = #{testPlanCaseId,jdbcType=VARCHAR},
|
set test_plan_case_id = #{testPlanCaseId,jdbcType=VARCHAR},
|
||||||
|
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
|
||||||
case_id = #{caseId,jdbcType=VARCHAR},
|
case_id = #{caseId,jdbcType=VARCHAR},
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
deleted = #{deleted,jdbcType=BIT},
|
deleted = #{deleted,jdbcType=BIT},
|
||||||
|
@ -337,14 +355,14 @@
|
||||||
</update>
|
</update>
|
||||||
<insert id="batchInsert" parameterType="map">
|
<insert id="batchInsert" parameterType="map">
|
||||||
insert into test_plan_case_execute_history
|
insert into test_plan_case_execute_history
|
||||||
(id, test_plan_case_id, case_id, `status`, deleted, notifier, create_user, create_time,
|
(id, test_plan_case_id, test_plan_id, case_id, `status`, deleted, notifier, create_user,
|
||||||
content, steps)
|
create_time, content, steps)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanCaseId,jdbcType=VARCHAR}, #{item.caseId,jdbcType=VARCHAR},
|
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanCaseId,jdbcType=VARCHAR}, #{item.testPlanId,jdbcType=VARCHAR},
|
||||||
#{item.status,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT}, #{item.notifier,jdbcType=VARCHAR},
|
#{item.caseId,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT},
|
||||||
#{item.createUser,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.content,jdbcType=LONGVARBINARY},
|
#{item.notifier,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT},
|
||||||
#{item.steps,jdbcType=LONGVARBINARY})
|
#{item.content,jdbcType=LONGVARBINARY}, #{item.steps,jdbcType=LONGVARBINARY})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="batchInsertSelective" parameterType="map">
|
<insert id="batchInsertSelective" parameterType="map">
|
||||||
|
@ -363,6 +381,9 @@
|
||||||
<if test="'test_plan_case_id'.toString() == column.value">
|
<if test="'test_plan_case_id'.toString() == column.value">
|
||||||
#{item.testPlanCaseId,jdbcType=VARCHAR}
|
#{item.testPlanCaseId,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="'test_plan_id'.toString() == column.value">
|
||||||
|
#{item.testPlanId,jdbcType=VARCHAR}
|
||||||
|
</if>
|
||||||
<if test="'case_id'.toString() == column.value">
|
<if test="'case_id'.toString() == column.value">
|
||||||
#{item.caseId,jdbcType=VARCHAR}
|
#{item.caseId,jdbcType=VARCHAR}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -45,6 +45,7 @@ ALTER TABLE test_plan_functional_case DROP COLUMN num;
|
||||||
CREATE TABLE IF NOT EXISTS test_plan_case_execute_history(
|
CREATE TABLE IF NOT EXISTS test_plan_case_execute_history(
|
||||||
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
|
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
|
||||||
`test_plan_case_id` VARCHAR(50) NOT NULL COMMENT '计划关联用例表ID' ,
|
`test_plan_case_id` VARCHAR(50) NOT NULL COMMENT '计划关联用例表ID' ,
|
||||||
|
`test_plan_id` VARCHAR(50) NOT NULL COMMENT '测试计划id' ,
|
||||||
`case_id` VARCHAR(50) NOT NULL COMMENT '用例ID' ,
|
`case_id` VARCHAR(50) NOT NULL COMMENT '用例ID' ,
|
||||||
`status` VARCHAR(64) NOT NULL COMMENT '执行结果:成功/失败/阻塞' ,
|
`status` VARCHAR(64) NOT NULL COMMENT '执行结果:成功/失败/阻塞' ,
|
||||||
`content` LONGBLOB COMMENT '执行评论意见' ,
|
`content` LONGBLOB COMMENT '执行评论意见' ,
|
||||||
|
@ -62,6 +63,8 @@ CREATE TABLE IF NOT EXISTS test_plan_case_execute_history(
|
||||||
CREATE INDEX idx_test_plan_case_id ON test_plan_case_execute_history(test_plan_case_id);
|
CREATE INDEX idx_test_plan_case_id ON test_plan_case_execute_history(test_plan_case_id);
|
||||||
CREATE INDEX idx_status ON test_plan_case_execute_history(status);
|
CREATE INDEX idx_status ON test_plan_case_execute_history(status);
|
||||||
CREATE INDEX idx_deleted ON test_plan_case_execute_history(deleted);
|
CREATE INDEX idx_deleted ON test_plan_case_execute_history(deleted);
|
||||||
|
CREATE INDEX idx_test_plan_id ON test_plan_case_execute_history(test_plan_id);
|
||||||
|
CREATE INDEX idx_case_id ON test_plan_case_execute_history(case_id);
|
||||||
|
|
||||||
-- 计划报告
|
-- 计划报告
|
||||||
CREATE TABLE IF NOT EXISTS test_plan_report(
|
CREATE TABLE IF NOT EXISTS test_plan_report(
|
||||||
|
|
|
@ -568,6 +568,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
|
||||||
public void testPlanExecuteHistoryList() throws Exception {
|
public void testPlanExecuteHistoryList() throws Exception {
|
||||||
TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory();
|
TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory();
|
||||||
testPlanCaseExecuteHistory.setTestPlanCaseId("associate_case_plan_gyq_one");
|
testPlanCaseExecuteHistory.setTestPlanCaseId("associate_case_plan_gyq_one");
|
||||||
|
testPlanCaseExecuteHistory.setTestPlanId("test_plan_associate_case_gyq_one");
|
||||||
testPlanCaseExecuteHistory.setCaseId("gyq_associate_function_case");
|
testPlanCaseExecuteHistory.setCaseId("gyq_associate_function_case");
|
||||||
testPlanCaseExecuteHistory.setCreateUser("admin");
|
testPlanCaseExecuteHistory.setCreateUser("admin");
|
||||||
testPlanCaseExecuteHistory.setStatus(FunctionalCaseReviewStatus.RE_REVIEWED.toString());
|
testPlanCaseExecuteHistory.setStatus(FunctionalCaseReviewStatus.RE_REVIEWED.toString());
|
||||||
|
@ -579,7 +580,8 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
|
||||||
List<TestPlanCaseExecuteHistoryDTO> gyqReviewCaseTest = getPlanExecuteHistoryList("gyq_associate_function_case");
|
List<TestPlanCaseExecuteHistoryDTO> gyqReviewCaseTest = getPlanExecuteHistoryList("gyq_associate_function_case");
|
||||||
Assertions.assertTrue(StringUtils.isNotBlank(gyqReviewCaseTest.get(0).getContentText()));
|
Assertions.assertTrue(StringUtils.isNotBlank(gyqReviewCaseTest.get(0).getContentText()));
|
||||||
testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory();
|
testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory();
|
||||||
testPlanCaseExecuteHistory.setTestPlanCaseId("associate_case_plan_gyq_two");
|
testPlanCaseExecuteHistory.setTestPlanCaseId("test_plan_associate_case_gyq_two");
|
||||||
|
testPlanCaseExecuteHistory.setTestPlanId("associate_case_plan_gyq_two");
|
||||||
testPlanCaseExecuteHistory.setCaseId("gyq_associate_function_case");
|
testPlanCaseExecuteHistory.setCaseId("gyq_associate_function_case");
|
||||||
testPlanCaseExecuteHistory.setCreateUser("admin");
|
testPlanCaseExecuteHistory.setCreateUser("admin");
|
||||||
testPlanCaseExecuteHistory.setStatus(FunctionalCaseReviewStatus.RE_REVIEWED.toString());
|
testPlanCaseExecuteHistory.setStatus(FunctionalCaseReviewStatus.RE_REVIEWED.toString());
|
||||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.plan.domain.TestPlanFunctionalCaseExample;
|
||||||
import io.metersphere.plan.dto.TestPlanResourceAssociationParam;
|
import io.metersphere.plan.dto.TestPlanResourceAssociationParam;
|
||||||
import io.metersphere.plan.mapper.ExtTestPlanFunctionalCaseMapper;
|
import io.metersphere.plan.mapper.ExtTestPlanFunctionalCaseMapper;
|
||||||
import io.metersphere.plan.mapper.TestPlanFunctionalCaseMapper;
|
import io.metersphere.plan.mapper.TestPlanFunctionalCaseMapper;
|
||||||
|
import io.metersphere.sdk.constants.FunctionalCaseExecuteResult;
|
||||||
import io.metersphere.system.uid.IDGenerator;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import io.metersphere.system.utils.ServiceUtils;
|
import io.metersphere.system.utils.ServiceUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
@ -43,6 +44,8 @@ public class TestPlanCaseService {
|
||||||
testPlanFunctionalCase.setPos(pox);
|
testPlanFunctionalCase.setPos(pox);
|
||||||
testPlanFunctionalCase.setCreateTime(now);
|
testPlanFunctionalCase.setCreateTime(now);
|
||||||
testPlanFunctionalCase.setCreateUser(associationParam.getOperator());
|
testPlanFunctionalCase.setCreateUser(associationParam.getOperator());
|
||||||
|
testPlanFunctionalCase.setLastExecResult(FunctionalCaseExecuteResult.PENDING.name());
|
||||||
|
testPlanFunctionalCase.setExecuteUser(associationParam.getOperator());
|
||||||
testPlanFunctionalCaseList.add(testPlanFunctionalCase);
|
testPlanFunctionalCaseList.add(testPlanFunctionalCase);
|
||||||
pox += ServiceUtils.POS_STEP;
|
pox += ServiceUtils.POS_STEP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import io.metersphere.bug.mapper.ExtBugRelateCaseMapper;
|
||||||
import io.metersphere.dto.BugProviderDTO;
|
import io.metersphere.dto.BugProviderDTO;
|
||||||
import io.metersphere.functional.constants.CaseFileSourceType;
|
import io.metersphere.functional.constants.CaseFileSourceType;
|
||||||
import io.metersphere.functional.domain.FunctionalCase;
|
import io.metersphere.functional.domain.FunctionalCase;
|
||||||
import io.metersphere.functional.domain.FunctionalCaseExample;
|
|
||||||
import io.metersphere.functional.domain.FunctionalCaseModule;
|
import io.metersphere.functional.domain.FunctionalCaseModule;
|
||||||
import io.metersphere.functional.dto.*;
|
import io.metersphere.functional.dto.*;
|
||||||
import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
||||||
|
@ -42,7 +41,6 @@ import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.sdk.util.SubListUtils;
|
import io.metersphere.sdk.util.SubListUtils;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.dto.LogInsertModule;
|
import io.metersphere.system.dto.LogInsertModule;
|
||||||
import io.metersphere.system.dto.builder.LogDTOBuilder;
|
|
||||||
import io.metersphere.system.dto.sdk.BaseTreeNode;
|
import io.metersphere.system.dto.sdk.BaseTreeNode;
|
||||||
import io.metersphere.system.dto.user.UserDTO;
|
import io.metersphere.system.dto.user.UserDTO;
|
||||||
import io.metersphere.system.log.aspect.OperationLogAspect;
|
import io.metersphere.system.log.aspect.OperationLogAspect;
|
||||||
|
@ -409,10 +407,6 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
TestPlanCaseExecuteHistory executeHistory = buildHistory(request, logInsertModule.getOperator());
|
TestPlanCaseExecuteHistory executeHistory = buildHistory(request, logInsertModule.getOperator());
|
||||||
testPlanCaseExecuteHistoryMapper.insert(executeHistory);
|
testPlanCaseExecuteHistoryMapper.insert(executeHistory);
|
||||||
|
|
||||||
Map<String, String> idsMap = new HashMap<>();
|
|
||||||
idsMap.put(request.getId(), request.getCaseId());
|
|
||||||
List<LogDTO> logDTOList = runLog(idsMap, Arrays.asList(request.getCaseId()), request.getProjectId(), organizationId, new ResourceLogInsertModule(TestPlanResourceConstants.RESOURCE_FUNCTIONAL_CASE, logInsertModule));
|
|
||||||
operationLogService.batchAdd(logDTOList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -439,6 +433,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
TestPlanCaseExecuteHistory executeHistory = new TestPlanCaseExecuteHistory();
|
TestPlanCaseExecuteHistory executeHistory = new TestPlanCaseExecuteHistory();
|
||||||
executeHistory.setId(IDGenerator.nextStr());
|
executeHistory.setId(IDGenerator.nextStr());
|
||||||
executeHistory.setTestPlanCaseId(request.getId());
|
executeHistory.setTestPlanCaseId(request.getId());
|
||||||
|
executeHistory.setTestPlanId(request.getTestPlanId());
|
||||||
executeHistory.setCaseId(request.getCaseId());
|
executeHistory.setCaseId(request.getCaseId());
|
||||||
executeHistory.setStatus(request.getLastExecResult());
|
executeHistory.setStatus(request.getLastExecResult());
|
||||||
executeHistory.setContent(request.getContent().getBytes());
|
executeHistory.setContent(request.getContent().getBytes());
|
||||||
|
@ -484,8 +479,6 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
|
|
||||||
updateFunctionalCaseStatus(caseIds, request.getLastExecResult());
|
updateFunctionalCaseStatus(caseIds, request.getLastExecResult());
|
||||||
|
|
||||||
List<LogDTO> logDTOList = runLog(idsMap, caseIds, request.getProjectId(), organizationId, new ResourceLogInsertModule(TestPlanResourceConstants.RESOURCE_FUNCTIONAL_CASE, logInsertModule));
|
|
||||||
operationLogService.batchAdd(logDTOList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TestPlanCaseExecuteHistory> getExecHistory(List<String> ids, TestPlanCaseBatchRunRequest request, LogInsertModule logInsertModule, Map<String, String> idsMap) {
|
private List<TestPlanCaseExecuteHistory> getExecHistory(List<String> ids, TestPlanCaseBatchRunRequest request, LogInsertModule logInsertModule, Map<String, String> idsMap) {
|
||||||
|
@ -495,6 +488,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
TestPlanCaseExecuteHistory executeHistory = new TestPlanCaseExecuteHistory();
|
TestPlanCaseExecuteHistory executeHistory = new TestPlanCaseExecuteHistory();
|
||||||
executeHistory.setId(IDGenerator.nextStr());
|
executeHistory.setId(IDGenerator.nextStr());
|
||||||
executeHistory.setTestPlanCaseId(id);
|
executeHistory.setTestPlanCaseId(id);
|
||||||
|
executeHistory.setTestPlanId(request.getTestPlanId());
|
||||||
executeHistory.setCaseId(idsMap.get(id));
|
executeHistory.setCaseId(idsMap.get(id));
|
||||||
executeHistory.setStatus(request.getLastExecResult());
|
executeHistory.setStatus(request.getLastExecResult());
|
||||||
executeHistory.setContent(request.getContent().getBytes());
|
executeHistory.setContent(request.getContent().getBytes());
|
||||||
|
@ -533,30 +527,6 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<LogDTO> runLog(Map<String, String> idsMap, List<String> caseIds, String projectId, String organizationId, ResourceLogInsertModule logInsertModule) {
|
|
||||||
FunctionalCaseExample example = new FunctionalCaseExample();
|
|
||||||
example.createCriteria().andIdIn(caseIds);
|
|
||||||
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(example);
|
|
||||||
Map<String, String> caseMap = functionalCases.stream().collect(Collectors.toMap(FunctionalCase::getId, FunctionalCase::getName));
|
|
||||||
List<LogDTO> list = new ArrayList<>();
|
|
||||||
idsMap.forEach((k, v) -> {
|
|
||||||
LogDTO dto = LogDTOBuilder.builder()
|
|
||||||
.projectId(projectId)
|
|
||||||
.organizationId(organizationId)
|
|
||||||
.type(OperationLogType.EXECUTE.name())
|
|
||||||
.module(OperationLogModule.TEST_PLAN)
|
|
||||||
.method(logInsertModule.getRequestMethod())
|
|
||||||
.path(logInsertModule.getRequestUrl())
|
|
||||||
.sourceId(k)
|
|
||||||
.content(Translator.get("run_functional_case") + ":" + caseMap.get(v))
|
|
||||||
.createUser(logInsertModule.getOperator())
|
|
||||||
.build().getLogDTO();
|
|
||||||
list.add(dto);
|
|
||||||
});
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量更新执行人
|
* 批量更新执行人
|
||||||
*
|
*
|
||||||
|
@ -623,7 +593,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setHistoryInfo(FunctionalCaseStepDTO newCaseStep, Map<String, FunctionalCaseStepDTO> historyStepMap) {
|
private static void setHistoryInfo(FunctionalCaseStepDTO newCaseStep, Map<String, FunctionalCaseStepDTO> historyStepMap) {
|
||||||
FunctionalCaseStepDTO historyStep = historyStepMap.get(newCaseStep.getId());
|
FunctionalCaseStepDTO historyStep = historyStepMap.get(newCaseStep.getId());
|
||||||
if (historyStep != null && StringUtils.equals(historyStep.getDesc(), newCaseStep.getDesc()) && StringUtils.equals(historyStep.getResult(), newCaseStep.getResult())) {
|
if (historyStep != null && StringUtils.equals(historyStep.getDesc(), newCaseStep.getDesc()) && StringUtils.equals(historyStep.getResult(), newCaseStep.getResult())) {
|
||||||
newCaseStep.setExecuteResult(historyStep.getExecuteResult());
|
newCaseStep.setExecuteResult(historyStep.getExecuteResult());
|
||||||
|
@ -645,6 +615,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
TestPlanCaseExecuteHistory executeHistory = new TestPlanCaseExecuteHistory();
|
TestPlanCaseExecuteHistory executeHistory = new TestPlanCaseExecuteHistory();
|
||||||
executeHistory.setId(IDGenerator.nextStr());
|
executeHistory.setId(IDGenerator.nextStr());
|
||||||
executeHistory.setTestPlanCaseId(planFunctionalCase.getId());
|
executeHistory.setTestPlanCaseId(planFunctionalCase.getId());
|
||||||
|
executeHistory.setTestPlanId(planFunctionalCase.getTestPlanId());
|
||||||
executeHistory.setCaseId(planFunctionalCase.getFunctionalCaseId());
|
executeHistory.setCaseId(planFunctionalCase.getFunctionalCaseId());
|
||||||
executeHistory.setStatus(request.getLastExecResult());
|
executeHistory.setStatus(request.getLastExecResult());
|
||||||
executeHistory.setDeleted(false);
|
executeHistory.setDeleted(false);
|
||||||
|
|
|
@ -74,6 +74,8 @@ public class TestPlanService extends TestPlanBaseUtilsService {
|
||||||
private UserMapper userMapper;
|
private UserMapper userMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private TestPlanSendNoticeService testPlanSendNoticeService;
|
private TestPlanSendNoticeService testPlanSendNoticeService;
|
||||||
|
@Resource
|
||||||
|
private TestPlanCaseExecuteHistoryMapper testPlanCaseExecuteHistoryMapper;
|
||||||
private static final int MAX_TAG_SIZE = 10;
|
private static final int MAX_TAG_SIZE = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,7 +241,7 @@ public class TestPlanService extends TestPlanBaseUtilsService {
|
||||||
/**
|
/**
|
||||||
* 级联删除计划关联的资源
|
* 级联删除计划关联的资源
|
||||||
*
|
*
|
||||||
* @param testPlanIds 计划ID集合
|
* @param testPlanIds 计划ID集合
|
||||||
* @param testPlanReportService 这个方法会在批处理中使用,所以service在调用处通过传参的方式传入
|
* @param testPlanReportService 这个方法会在批处理中使用,所以service在调用处通过传参的方式传入
|
||||||
*/
|
*/
|
||||||
private void cascadeDeleteTestPlanIds(List<String> testPlanIds, TestPlanReportService testPlanReportService) {
|
private void cascadeDeleteTestPlanIds(List<String> testPlanIds, TestPlanReportService testPlanReportService) {
|
||||||
|
@ -261,6 +263,10 @@ public class TestPlanService extends TestPlanBaseUtilsService {
|
||||||
allocationExample.createCriteria().andTestPlanIdIn(testPlanIds);
|
allocationExample.createCriteria().andTestPlanIdIn(testPlanIds);
|
||||||
testPlanAllocationMapper.deleteByExample(allocationExample);
|
testPlanAllocationMapper.deleteByExample(allocationExample);
|
||||||
|
|
||||||
|
TestPlanCaseExecuteHistoryExample historyExample = new TestPlanCaseExecuteHistoryExample();
|
||||||
|
historyExample.createCriteria().andTestPlanIdIn(testPlanIds);
|
||||||
|
testPlanCaseExecuteHistoryMapper.deleteByExample(historyExample);
|
||||||
|
|
||||||
//删除测试计划报告 todo: 正式版增加接口用例报告、接口场景报告的清理
|
//删除测试计划报告 todo: 正式版增加接口用例报告、接口场景报告的清理
|
||||||
testPlanReportService.deleteByTestPlanIds(testPlanIds);
|
testPlanReportService.deleteByTestPlanIds(testPlanIds);
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -306,6 +306,7 @@ public class TestPlanCaseControllerTests extends BaseTest {
|
||||||
TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory();
|
TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory();
|
||||||
testPlanCaseExecuteHistory.setCaseId("gyq_disassociate_fc_4");
|
testPlanCaseExecuteHistory.setCaseId("gyq_disassociate_fc_4");
|
||||||
testPlanCaseExecuteHistory.setTestPlanCaseId("gyq_disassociate_case_4");
|
testPlanCaseExecuteHistory.setTestPlanCaseId("gyq_disassociate_case_4");
|
||||||
|
testPlanCaseExecuteHistory.setTestPlanId("gyq_disassociate_plan_2");
|
||||||
testPlanCaseExecuteHistory.setDeleted(false);
|
testPlanCaseExecuteHistory.setDeleted(false);
|
||||||
testPlanCaseExecuteHistory.setId("history_id");
|
testPlanCaseExecuteHistory.setId("history_id");
|
||||||
testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis());
|
testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis());
|
||||||
|
|
|
@ -59,8 +59,8 @@ INSERT INTO template (id,name,remark,internal,update_time,create_time,create_use
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO `test_plan_case_execute_history`(`id`, `test_plan_case_id`, `case_id`, `status`, `content`, `steps`, `deleted`, `notifier`, `create_user`, `create_time`)
|
INSERT INTO `test_plan_case_execute_history`(`id`, `test_plan_case_id`, `test_plan_id`, `case_id`, `status`, `content`, `steps`, `deleted`, `notifier`, `create_user`, `create_time`)
|
||||||
VALUES
|
VALUES
|
||||||
('123445', 'relate_case_1', 'fc_1', 'PASSED', '1234', '2132134', b'0', '', 'admin', 1715828421525);
|
('123445', 'relate_case_1', 'plan_1', 'fc_1', 'PASSED', '1234', '2132134', b'0', '', 'admin', 1715828421525);
|
||||||
INSERT INTO functional_case_blob(id, steps, text_description, expected_result, prerequisite, description) VALUES ('fc_1', 'STEP', '1111', '', '', 'TEST');
|
INSERT INTO functional_case_blob(id, steps, text_description, expected_result, prerequisite, description) VALUES ('fc_1', 'STEP', '1111', '', '', 'TEST');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue