用例缺陷

This commit is contained in:
chenjianxing 2020-05-16 14:30:55 +08:00
parent 4687f01425
commit f810e19fe2
11 changed files with 115 additions and 41 deletions

View File

@ -21,7 +21,5 @@ public class TestPlanTestCase implements Serializable {
private Long updateTime;
private String results;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,17 @@
package io.metersphere.base.domain;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class TestPlanTestCaseWithBLOBs extends TestPlanTestCase implements Serializable {
private String results;
private String flaw;
private static final long serialVersionUID = 1L;
}

View File

@ -2,6 +2,7 @@ package io.metersphere.base.mapper;
import io.metersphere.base.domain.TestPlanTestCase;
import io.metersphere.base.domain.TestPlanTestCaseExample;
import io.metersphere.base.domain.TestPlanTestCaseWithBLOBs;
import java.util.List;
import org.apache.ibatis.annotations.Param;
@ -12,25 +13,25 @@ public interface TestPlanTestCaseMapper {
int deleteByPrimaryKey(String id);
int insert(TestPlanTestCase record);
int insert(TestPlanTestCaseWithBLOBs record);
int insertSelective(TestPlanTestCase record);
int insertSelective(TestPlanTestCaseWithBLOBs record);
List<TestPlanTestCase> selectByExampleWithBLOBs(TestPlanTestCaseExample example);
List<TestPlanTestCaseWithBLOBs> selectByExampleWithBLOBs(TestPlanTestCaseExample example);
List<TestPlanTestCase> selectByExample(TestPlanTestCaseExample example);
TestPlanTestCase selectByPrimaryKey(String id);
TestPlanTestCaseWithBLOBs selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") TestPlanTestCase record, @Param("example") TestPlanTestCaseExample example);
int updateByExampleSelective(@Param("record") TestPlanTestCaseWithBLOBs record, @Param("example") TestPlanTestCaseExample example);
int updateByExampleWithBLOBs(@Param("record") TestPlanTestCase record, @Param("example") TestPlanTestCaseExample example);
int updateByExampleWithBLOBs(@Param("record") TestPlanTestCaseWithBLOBs record, @Param("example") TestPlanTestCaseExample example);
int updateByExample(@Param("record") TestPlanTestCase record, @Param("example") TestPlanTestCaseExample example);
int updateByPrimaryKeySelective(TestPlanTestCase record);
int updateByPrimaryKeySelective(TestPlanTestCaseWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(TestPlanTestCase record);
int updateByPrimaryKeyWithBLOBs(TestPlanTestCaseWithBLOBs record);
int updateByPrimaryKey(TestPlanTestCase record);
}

View File

@ -11,8 +11,9 @@
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanTestCase">
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
<result column="results" jdbcType="LONGVARCHAR" property="results" />
<result column="flaw" jdbcType="LONGVARCHAR" property="flaw" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -76,7 +77,7 @@
id, plan_id, case_id, executor, status, remark, create_time, update_time
</sql>
<sql id="Blob_Column_List">
results
results, flaw
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanTestCaseExample" resultMap="ResultMapWithBLOBs">
select
@ -126,17 +127,17 @@
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanTestCase">
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
insert into test_plan_test_case (id, plan_id, case_id,
executor, status, remark,
create_time, update_time, results
)
create_time, update_time, results,
flaw)
values (#{id,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR},
#{executor,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{results,jdbcType=LONGVARCHAR}
)
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{results,jdbcType=LONGVARCHAR},
#{flaw,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanTestCase">
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
insert into test_plan_test_case
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -166,6 +167,9 @@
<if test="results != null">
results,
</if>
<if test="flaw != null">
flaw,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -195,6 +199,9 @@
<if test="results != null">
#{results,jdbcType=LONGVARCHAR},
</if>
<if test="flaw != null">
#{flaw,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanTestCaseExample" resultType="java.lang.Long">
@ -233,6 +240,9 @@
<if test="record.results != null">
results = #{record.results,jdbcType=LONGVARCHAR},
</if>
<if test="record.flaw != null">
flaw = #{record.flaw,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -248,7 +258,8 @@
remark = #{record.remark,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
results = #{record.results,jdbcType=LONGVARCHAR}
results = #{record.results,jdbcType=LONGVARCHAR},
flaw = #{record.flaw,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -267,7 +278,7 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestPlanTestCase">
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
update test_plan_test_case
<set>
<if test="planId != null">
@ -294,10 +305,13 @@
<if test="results != null">
results = #{results,jdbcType=LONGVARCHAR},
</if>
<if test="flaw != null">
flaw = #{flaw,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanTestCase">
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
update test_plan_test_case
set plan_id = #{planId,jdbcType=VARCHAR},
case_id = #{caseId,jdbcType=VARCHAR},
@ -306,7 +320,8 @@
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
results = #{results,jdbcType=LONGVARCHAR}
results = #{results,jdbcType=LONGVARCHAR},
flaw = #{flaw,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlanTestCase">

View File

@ -3,6 +3,7 @@ package io.metersphere.track.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.TestPlanTestCase;
import io.metersphere.base.domain.TestPlanTestCaseWithBLOBs;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest;
@ -48,7 +49,7 @@ public class TestPlanTestCaseController {
}
@PostMapping("/edit")
public void editTestCase(@RequestBody TestPlanTestCase testPlanTestCase){
public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase){
testPlanTestCaseService.editTestCase(testPlanTestCase);
}

View File

@ -14,4 +14,5 @@ public class TestPlanCaseDTO extends TestCaseWithBLOBs {
private String planId;
private String planName;
private String caseId;
private String flaw;
}

View File

@ -117,7 +117,7 @@ public class TestPlanService {
if (!testCaseIds.isEmpty()) {
testCaseIds.forEach(caseId -> {
TestCaseWithBLOBs testCase = testCaseMap.get(caseId);
TestPlanTestCase testPlanTestCase = new TestPlanTestCase();
TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs();
testPlanTestCase.setId(UUID.randomUUID().toString());
testPlanTestCase.setExecutor(testCase.getMaintainer());
testPlanTestCase.setCaseId(caseId);

View File

@ -52,7 +52,7 @@ public class TestPlanTestCaseService {
return list;
}
public void editTestCase(TestPlanTestCase testPlanTestCase) {
public void editTestCase(TestPlanTestCaseWithBLOBs testPlanTestCase) {
if (StringUtils.equals(TestPlanTestCaseStatus.Prepare.name(), testPlanTestCase.getStatus())) {
testPlanTestCase.setStatus(TestPlanTestCaseStatus.Underway.name());
}
@ -68,7 +68,7 @@ public class TestPlanTestCaseService {
TestPlanTestCaseExample testPlanTestCaseExample = new TestPlanTestCaseExample();
testPlanTestCaseExample.createCriteria().andIdIn(request.getIds());
TestPlanTestCase testPlanTestCase = new TestPlanTestCase();
TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs();
BeanUtils.copyBean(testPlanTestCase, request);
testPlanTestCaseMapper.updateByExampleSelective(
testPlanTestCase,

View File

@ -317,6 +317,7 @@ CREATE TABLE IF NOT EXISTS `test_plan_test_case` (
`executor` varchar(64) NOT NULL COMMENT 'Test case executor',
`status` varchar(15) NULL COMMENT 'Test case status',
`results` longtext COMMENT 'Test case result',
`flaw` longtext COMMENT 'Test case result flaw',
`remark` varchar(255) DEFAULT NULL COMMENT 'Test case remark',
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',

View File

@ -59,21 +59,7 @@
<!--要生成的数据库表 -->
<table tableName="test_plan"/>
<table tableName="test_case_node"/>
<table tableName="test_case"/>
<table tableName="test_plan_test_case"/>
<table tableName="test_case_report_template"/>
<table tableName="test_case_report"/>
<!--<table tableName="test_case_node">-->
<!--<generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!--</table>-->
<!--<table tableName="test_case_report_template">-->
<!--<generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!--</table>-->
</context>
</generatorConfiguration>

View File

@ -137,6 +137,22 @@
</el-col>
</el-row>
<el-row>
<el-col :span="5" :offset="1">
<el-switch
v-model="hasFlaw"
@change="flawChange"
active-text="提缺陷">
</el-switch>
</el-col>
</el-row>
<el-row v-if="hasFlaw">
<el-col :span="20" :offset="1" class="step-edit">
<ckeditor :editor="editor" v-model="testCase.flaw"/>
</el-col>
</el-row>
<el-row>
<el-col :span="15" :offset="1">
<div>
@ -167,6 +183,7 @@
<script>
import TestPlanTestCaseStatusButton from '../../common/TestPlanTestCaseStatusButton';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
export default {
name: "TestPlanTestCaseEdit",
@ -177,7 +194,9 @@
showDialog: false,
testCase: {},
index: 0,
testCases: []
testCases: [],
editor: ClassicEditor,
hasFlaw: false
};
},
props: {
@ -211,6 +230,7 @@
param.results.push(result);
});
param.results = JSON.stringify(param.results);
param.flaw = this.testCase.flaw;
this.$post('/test/plan/case/edit', param, () => {
if (isContinuous) {
this.updateTestCases(param);
@ -249,6 +269,11 @@
},
openTestCaseEdit(testCase) {
this.showDialog = true;
if (testCase.flaw) {
this.hasFlaw = true;
} else {
this.hasFlaw = false;
}
this.initData(testCase);
},
updateTestCases(testCase) {
@ -268,6 +293,23 @@
}
}
});
},
flawChange() {
if (this.hasFlaw && !this.testCase.flaw) {
let desc = this.addPLabel('[' + '操作步骤' + ']');
let result = this.addPLabel('[' + '预期结果' + ']');
let executeResult = this.addPLabel('[' + '实际结果' + ']');
this.testCase.steps.forEach(step => {
let stepPrefix = '步骤' + step.num + ':';
desc += this.addPLabel(stepPrefix + (step.desc == undefined ? '' : step.desc));
result += this.addPLabel(stepPrefix + (step.result == undefined ? '' : step.result));
executeResult += this.addPLabel(stepPrefix + (step.executeResult == undefined ? '' : step.executeResult));
});
this.testCase.flaw = desc + this.addPLabel('') + result + this.addPLabel('') + executeResult + this.addPLabel('');
}
},
addPLabel(str) {
return "<p>" + str + "</p>";
}
}
}
@ -302,6 +344,10 @@
line-height: 50px;
}
.step-edit >>> p {
line-height: 16px;
}
.status-button {
float: right;
}
@ -322,4 +368,12 @@
margin-top: 1%;
}
.el-switch >>> .el-switch__label {
color: dimgray;
}
.el-switch >>> .el-switch__label.is-active {
color: #409EFF;
}
</style>