feat: 测试用例增加状态列

This commit is contained in:
shiziyuan9527 2020-10-09 15:49:33 +08:00
parent 01f5dd02a1
commit 47ed214502
15 changed files with 148 additions and 24 deletions

View File

@ -37,5 +37,7 @@ public class TestCase implements Serializable {
private String otherTestName;
private String reviewStatus;
private static final long serialVersionUID = 1L;
}

View File

@ -1183,6 +1183,76 @@ public class TestCaseExample {
addCriterion("other_test_name not between", value1, value2, "otherTestName");
return (Criteria) this;
}
public Criteria andReviewStatusIsNull() {
addCriterion("review_status is null");
return (Criteria) this;
}
public Criteria andReviewStatusIsNotNull() {
addCriterion("review_status is not null");
return (Criteria) this;
}
public Criteria andReviewStatusEqualTo(String value) {
addCriterion("review_status =", value, "reviewStatus");
return (Criteria) this;
}
public Criteria andReviewStatusNotEqualTo(String value) {
addCriterion("review_status <>", value, "reviewStatus");
return (Criteria) this;
}
public Criteria andReviewStatusGreaterThan(String value) {
addCriterion("review_status >", value, "reviewStatus");
return (Criteria) this;
}
public Criteria andReviewStatusGreaterThanOrEqualTo(String value) {
addCriterion("review_status >=", value, "reviewStatus");
return (Criteria) this;
}
public Criteria andReviewStatusLessThan(String value) {
addCriterion("review_status <", value, "reviewStatus");
return (Criteria) this;
}
public Criteria andReviewStatusLessThanOrEqualTo(String value) {
addCriterion("review_status <=", value, "reviewStatus");
return (Criteria) this;
}
public Criteria andReviewStatusLike(String value) {
addCriterion("review_status like", value, "reviewStatus");
return (Criteria) this;
}
public Criteria andReviewStatusNotLike(String value) {
addCriterion("review_status not like", value, "reviewStatus");
return (Criteria) this;
}
public Criteria andReviewStatusIn(List<String> values) {
addCriterion("review_status in", values, "reviewStatus");
return (Criteria) this;
}
public Criteria andReviewStatusNotIn(List<String> values) {
addCriterion("review_status not in", values, "reviewStatus");
return (Criteria) this;
}
public Criteria andReviewStatusBetween(String value1, String value2) {
addCriterion("review_status between", value1, value2, "reviewStatus");
return (Criteria) this;
}
public Criteria andReviewStatusNotBetween(String value1, String value2) {
addCriterion("review_status not between", value1, value2, "reviewStatus");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -18,6 +18,7 @@
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="num" jdbcType="INTEGER" property="num" />
<result column="other_test_name" jdbcType="VARCHAR" property="otherTestName" />
<result column="review_status" jdbcType="VARCHAR" property="reviewStatus" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseWithBLOBs">
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
@ -83,7 +84,7 @@
</sql>
<sql id="Base_Column_List">
id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`,
prerequisite, create_time, update_time, test_id, sort, num, other_test_name
prerequisite, create_time, update_time, test_id, sort, num, other_test_name, review_status
</sql>
<sql id="Blob_Column_List">
remark, steps
@ -142,15 +143,15 @@
maintainer, priority, `method`,
prerequisite, create_time, update_time,
test_id, sort, num,
other_test_name, remark, steps
)
other_test_name, review_status, remark,
steps)
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
#{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{testId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER},
#{otherTestName,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR}
)
#{otherTestName,jdbcType=VARCHAR}, #{reviewStatus,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR},
#{steps,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
insert into test_case
@ -203,6 +204,9 @@
<if test="otherTestName != null">
other_test_name,
</if>
<if test="reviewStatus != null">
review_status,
</if>
<if test="remark != null">
remark,
</if>
@ -259,6 +263,9 @@
<if test="otherTestName != null">
#{otherTestName,jdbcType=VARCHAR},
</if>
<if test="reviewStatus != null">
#{reviewStatus,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=LONGVARCHAR},
</if>
@ -324,6 +331,9 @@
<if test="record.otherTestName != null">
other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
</if>
<if test="record.reviewStatus != null">
review_status = #{record.reviewStatus,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=LONGVARCHAR},
</if>
@ -353,6 +363,7 @@
sort = #{record.sort,jdbcType=INTEGER},
num = #{record.num,jdbcType=INTEGER},
other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
review_status = #{record.reviewStatus,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=LONGVARCHAR},
steps = #{record.steps,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
@ -376,7 +387,8 @@
test_id = #{record.testId,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER},
num = #{record.num,jdbcType=INTEGER},
other_test_name = #{record.otherTestName,jdbcType=VARCHAR}
other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
review_status = #{record.reviewStatus,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -429,6 +441,9 @@
<if test="otherTestName != null">
other_test_name = #{otherTestName,jdbcType=VARCHAR},
</if>
<if test="reviewStatus != null">
review_status = #{reviewStatus,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=LONGVARCHAR},
</if>
@ -455,6 +470,7 @@
sort = #{sort,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER},
other_test_name = #{otherTestName,jdbcType=VARCHAR},
review_status = #{reviewStatus,jdbcType=VARCHAR},
remark = #{remark,jdbcType=LONGVARCHAR},
steps = #{steps,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
@ -475,7 +491,8 @@
test_id = #{testId,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER},
other_test_name = #{otherTestName,jdbcType=VARCHAR}
other_test_name = #{otherTestName,jdbcType=VARCHAR},
review_status = #{reviewStatus,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -10,6 +10,6 @@ import java.util.List;
public interface ExtTestReviewCaseMapper {
List<TestReviewCaseDTO> list(@Param("request") QueryCaseReviewRequest request);
List<String> getStatusByReviewId(String planId);
List<String> getStatusByReviewId(String reviewId);
List<String> findRelateTestReviewId(String userId, String workspaceId);
}

View File

@ -182,9 +182,9 @@
</select>
<select id="getStatusByReviewId" resultType="java.lang.String">
select status
from test_case_review_test_case
where review_id = #{reviewId}
select review_status
from test_case
where id in (select case_id from test_case_review_test_case where review_id = #{reviewId});
</select>
<select id="findRelateTestReviewId" resultType="java.lang.String">

View File

@ -9,7 +9,7 @@ import lombok.Setter;
public class TestReviewCaseDTO extends TestCaseWithBLOBs {
private String reviewer;
private String reviewerName;
private String status;
private String reviewStatus;
private String results;
private String reviewId;
private String caseId;

View File

@ -6,8 +6,8 @@ import io.metersphere.base.mapper.ext.ExtProjectMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseReviewMapper;
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
import io.metersphere.commons.constants.TestCaseReviewStatus;
import io.metersphere.commons.constants.TestPlanStatus;
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
import io.metersphere.commons.constants.TestReviewCaseStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.LogUtil;
@ -32,7 +32,6 @@ import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@ -346,13 +345,13 @@ public class TestCaseReviewService {
testCaseReview.setId(reviewId);
for (String status : statusList) {
if (StringUtils.equals(status, TestPlanTestCaseStatus.Prepare.name())) {
testCaseReview.setStatus(TestPlanStatus.Underway.name());
if (StringUtils.equals(status, TestReviewCaseStatus.Prepare.name())) {
testCaseReview.setStatus(TestCaseReviewStatus.Underway.name());
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
return;
}
}
testCaseReview.setStatus(TestPlanStatus.Completed.name());
testCaseReview.setStatus(TestCaseReviewStatus.Completed.name());
SaveTestCaseReviewRequest testCaseReviewRequest = new SaveTestCaseReviewRequest();
TestCaseReview _testCaseReview = testCaseReviewMapper.selectByPrimaryKey(reviewId);
List<String> userIds = new ArrayList<>();
@ -414,8 +413,8 @@ public class TestCaseReviewService {
if (testCases != null) {
testReview.setTotal(testCases.size());
testCases.forEach(testCase -> {
if (!StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Prepare.name())
&& !StringUtils.equals(testCase.getStatus(), TestPlanTestCaseStatus.Underway.name())) {
if (!StringUtils.equals(testCase.getReviewStatus(), TestPlanTestCaseStatus.Prepare.name())
&& !StringUtils.equals(testCase.getReviewStatus(), TestPlanTestCaseStatus.Underway.name())) {
testReview.setReviewed(testReview.getReviewed() + 1);
}
});

View File

@ -10,6 +10,7 @@ import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.constants.TestCaseConstants;
import io.metersphere.commons.constants.TestCaseReviewStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.BeanUtils;
@ -88,6 +89,7 @@ public class TestCaseService {
testCase.setCreateTime(System.currentTimeMillis());
testCase.setUpdateTime(System.currentTimeMillis());
testCase.setNum(getNextNum(testCase.getProjectId()));
testCase.setReviewStatus(TestCaseReviewStatus.Prepare.name());
testCaseMapper.insert(testCase);
}
@ -341,6 +343,7 @@ public class TestCaseService {
testcase.setNodeId(nodePathMap.get(testcase.getNodePath()));
testcase.setSort(sort.getAndIncrement());
testcase.setNum(num.decrementAndGet());
testcase.setReviewStatus(TestCaseReviewStatus.Prepare.name());
mapper.insert(testcase);
});
}

View File

@ -1,6 +1,7 @@
package io.metersphere.track.service;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.TestCaseReviewMapper;
import io.metersphere.base.mapper.TestCaseReviewTestCaseMapper;
import io.metersphere.base.mapper.TestCaseReviewUsersMapper;
@ -38,6 +39,8 @@ public class TestReviewTestCaseService {
TestCaseReviewMapper testCaseReviewMapper;
@Resource
TestCaseReviewService testCaseReviewService;
@Resource
TestCaseMapper testCaseMapper;
public List<TestReviewCaseDTO> list(QueryCaseReviewRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
@ -111,9 +114,17 @@ public class TestReviewTestCaseService {
MSException.throwException("此用例评审已到截止时间!");
}
// 记录测试用例评审状态变更
testCaseReviewTestCase.setStatus(testCaseReviewTestCase.getStatus());
testCaseReviewTestCase.setReviewer(SessionUtils.getUser().getId());
testCaseReviewTestCase.setUpdateTime(System.currentTimeMillis());
testCaseReviewTestCaseMapper.updateByPrimaryKeySelective(testCaseReviewTestCase);
// 修改用例评审状态
String caseId = testCaseReviewTestCase.getCaseId();
TestCaseWithBLOBs testCase = new TestCaseWithBLOBs();
testCase.setId(caseId);
testCase.setReviewStatus(testCaseReviewTestCase.getStatus());
testCaseMapper.updateByPrimaryKeySelective(testCase);
}
}

View File

@ -0,0 +1,3 @@
alter table test_case add review_status varchar(25) null;
update test_case set review_status = 'Prepare' where review_status is null;

View File

@ -86,6 +86,18 @@
<method-table-item :value="scope.row.method"/>
</template>
</el-table-column>
<el-table-column
:filters="statusFilters"
column-key="status"
:label="$t('test_track.review_view.execute_result')">
<template v-slot:default="scope">
<span class="el-dropdown-link">
<status-table-item :value="scope.row.reviewStatus"/>
</span>
</template>
</el-table-column>
<el-table-column
prop="nodePath"
:label="$t('test_track.case.module')"
@ -146,6 +158,7 @@
import BatchEdit from "./BatchEdit";
import {WORKSPACE_ID} from "../../../../../common/js/constants";
import {LIST_CHANGE, TrackEvent} from "@/business/components/common/head/ListEvent";
import StatusTableItem from "@/business/components/track/common/tableItems/planview/StatusTableItem";
export default {
name: "TestCaseList",
@ -163,7 +176,8 @@
NodeBreadcrumb,
MsTableHeader,
ShowMoreBtn,
BatchEdit
BatchEdit,
StatusTableItem
},
data() {
return {
@ -192,6 +206,11 @@
{text: this.$t('commons.performance'), value: 'performance'},
{text: this.$t('commons.api'), value: 'api'}
],
statusFilters: [
{text: this.$t('test_track.plan.plan_status_prepare'), value: 'Prepare'},
{text: this.$t('test_track.plan_view.pass'), value: 'Pass'},
{text: '未通过', value: 'UnPass'},
],
showMore: false,
buttons: [
{

View File

@ -283,6 +283,7 @@ export default {
saveCase(status) {
let param = {};
param.id = this.testCase.id;
param.caseId = this.testCase.caseId;
param.reviewId = this.testCase.reviewId;
param.status = status;
this.$post('/test/review/case/edit', param, () => {

View File

@ -104,13 +104,12 @@
</el-table-column>
<el-table-column
prop="status"
:filters="statusFilters"
column-key="status"
:label="$t('test_track.review_view.execute_result')">
<template v-slot:default="scope">
<span class="el-dropdown-link">
<status-table-item :value="scope.row.status"/>
<status-table-item :value="scope.row.reviewStatus"/>
</span>
</template>
</el-table-column>

View File

@ -785,7 +785,7 @@ export default {
all_case: "全部用例",
start_review: "开始评审",
relevance_case: "关联用例",
execute_result: "执行结果",
execute_result: "评审结果",
},
module: {
search: "搜索模块",

View File

@ -785,7 +785,7 @@ export default {
all_case: "全部用例",
start_review: "開始評審",
relevance_case: "關聯用例",
execute_result: "執行結果",
execute_result: "評審結果",
},
module: {
search: "搜索模塊",