feat(测试跟踪): Merge pull request #430 from feiyu0316/master

实现https://github.com/metersphere/metersphere/issues/405
This commit is contained in:
BugKing 2020-09-24 17:17:16 +08:00 committed by GitHub
commit 6811ac187a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 167 additions and 44 deletions

View File

@ -25,6 +25,14 @@ public class TestPlan implements Serializable {
private String executorMatchRule;
private Long plannedStartTime;
private Long plannedEndTime;
private Long actualStartTime;
private Long actualEndTime;
private Long createTime;
private Long updateTime;

View File

@ -12,6 +12,10 @@
<result column="principal" jdbcType="VARCHAR" property="principal" />
<result column="test_case_match_rule" jdbcType="VARCHAR" property="testCaseMatchRule" />
<result column="executor_match_rule" jdbcType="VARCHAR" property="executorMatchRule" />
<result column="planned_start_time" jdbcType="BIGINT" property="plannedStartTime" />
<result column="planned_end_time" jdbcType="BIGINT" property="plannedEndTime" />
<result column="actual_start_time" jdbcType="BIGINT" property="actualStartTime" />
<result column="actual_end_time" jdbcType="BIGINT" property="actualEndTime" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
@ -78,7 +82,7 @@
</sql>
<sql id="Base_Column_List">
id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule,
executor_match_rule, create_time, update_time
executor_match_rule, planned_start_time, planned_end_time, actual_start_time, actual_end_time, create_time, update_time
</sql>
<sql id="Blob_Column_List">
tags
@ -135,13 +139,13 @@
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,
tags)
executor_match_rule, planned_start_time, planned_end_time, create_time,
update_time, 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},
#{tags,jdbcType=LONGVARCHAR})
#{executorMatchRule,jdbcType=VARCHAR}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{tags,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlan">
insert into test_plan
@ -176,6 +180,12 @@
<if test="executorMatchRule != null">
executor_match_rule,
</if>
<if test="plannedStartTime != null">
planned_start_time,
</if>
<if test="plannedEndTime != null">
planned_end_time,
</if>
<if test="createTime != null">
create_time,
</if>
@ -217,6 +227,12 @@
<if test="executorMatchRule != null">
#{executorMatchRule,jdbcType=VARCHAR},
</if>
<if test="plannedStartTime != null">
#{plannedStartTime,jdbcType=BIGINT},
</if>
<if test="plannedEndTime != null">
#{plannedEndTime,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
@ -267,6 +283,18 @@
<if test="record.executorMatchRule != null">
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
</if>
<if test="record.plannedStartTime != null">
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
</if>
<if test="record.plannedEndTime != null">
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
</if>
<if test="record.actualStartTime != null">
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
</if>
<if test="record.actualEndTime != null">
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
@ -293,6 +321,10 @@
principal = #{record.principal,jdbcType=VARCHAR},
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
tags = #{record.tags,jdbcType=LONGVARCHAR}
@ -312,6 +344,10 @@
principal = #{record.principal,jdbcType=VARCHAR},
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null">
@ -348,6 +384,18 @@
<if test="executorMatchRule != null">
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
</if>
<if test="plannedStartTime != null">
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
</if>
<if test="plannedEndTime != null">
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
</if>
<if test="actualStartTime != null">
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
</if>
<if test="actualEndTime != null">
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
@ -371,6 +419,10 @@
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
tags = #{tags,jdbcType=LONGVARCHAR}
@ -387,6 +439,10 @@
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}

View File

@ -95,6 +95,10 @@ public class TestPlanService {
testPlan.setId(testPlanId);
testPlan.setStatus(TestPlanStatus.Prepare.name());
testPlan.setPlannedStartTime(System.currentTimeMillis());
testPlan.setPlannedEndTime(System.currentTimeMillis());
testPlan.setActualStartTime(System.currentTimeMillis());
testPlan.setActualEndTime(System.currentTimeMillis());
testPlan.setCreateTime(System.currentTimeMillis());
testPlan.setUpdateTime(System.currentTimeMillis());
testPlanMapper.insert(testPlan);
@ -111,11 +115,20 @@ public class TestPlanService {
return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlan());
}
public int editTestPlan(TestPlanDTO testPlan) {
editTestPlanProject(testPlan);
public int editTestPlan(TestPlan testPlan) {
testPlan.setUpdateTime(System.currentTimeMillis());
checkTestPlanExist(testPlan);
//进行中状态写入实际开始时间
if ("Underway".equals(testPlan.getStatus())) {
testPlan.setActualStartTime(System.currentTimeMillis());
return testPlanMapper.updateByPrimaryKeySelective(testPlan);
} else if("Completed".equals(testPlan.getStatus())){
//已完成写入实际完成时间
testPlan.setActualEndTime(System.currentTimeMillis());
return testPlanMapper.updateByPrimaryKeySelective(testPlan);
} else {
return 0;
}
}
private void editTestPlanProject(TestPlanDTO testPlan) {

View File

@ -69,6 +69,30 @@
</el-col>
</el-row>
<!--start:xuxm增加自定义计划开始计划结束时间字段-->
<el-row>
<el-col :span="8" :offset="1">
<el-form-item
:placeholder="$t('test_track.plan.planned_start_time')"
:label="$t('test_track.plan.planned_start_time')"
:label-width="formLabelWidth"
prop="plannedStartTime">
<el-input v-model="form.planned_start_time" type="date" ></el-input>
</el-form-item>
</el-col>
<el-col :span="11" :offset="2">
<el-form-item
:placeholder="$t('test_track.plan.planned_end_time')"
:label="$t('test_track.plan.planned_end_time')"
:label-width="formLabelWidth"
prop="planned_end_time">
<el-input v-model="form.planned_end_time" type="date" ></el-input>
</el-form-item>
</el-col>
</el-row>
<!--end:xuxm增加自定义计划开始计划结束时间字段-->
<el-row type="flex" justify="left" style="margin-top: 10px;">
<el-col :span="23" :offset="1">
<el-form-item :label="$t('commons.description')" :label-width="formLabelWidth" prop="description">

View File

@ -70,20 +70,38 @@
</el-table-column>
<el-table-column
sortable
prop="createTime"
:label="$t('commons.create_time')"
prop="plannedStartTime"
:label="$t('test_track.plan.planned_start_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
<span>{{ scope.row.plannedStartTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
sortable
prop="updateTime"
:label="$t('commons.update_time')"
prop="plannedEndTime"
:label="$t('test_track.plan.planned_end_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
<span>{{ scope.row.plannedEndTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
sortable
prop="actualStartTime"
:label="$t('test_track.plan.actual_start_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.actualStartTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
sortable
prop="actualEndTime"
:label="$t('test_track.plan.actual_end_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.actualEndTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column

View File

@ -730,6 +730,10 @@ export default {
plan_status_prepare: "未开始",
plan_status_running: "进行中",
plan_status_completed: "已完成",
planned_start_time: "计划开始",
planned_end_time: "计划结束",
actual_start_time: "实际开始",
actual_end_time: "实际结束",
plan_delete_confirm: "将删除该测试计划下所有用例,确认删除测试计划: ",
plan_delete: "删除计划",
},