feat (接口定义): 增加用例状态字段
This commit is contained in:
parent
82d620925c
commit
e43777b4fa
|
@ -328,9 +328,13 @@ public class ApiTestCaseService {
|
|||
request = esbApiParamService.handleEsbRequest(request);
|
||||
}
|
||||
|
||||
final ApiTestCaseWithBLOBs test = new ApiTestCaseWithBLOBs();
|
||||
test.setId(request.getId());
|
||||
final ApiTestCaseWithBLOBs test = apiTestCaseMapper.selectByPrimaryKey(request.getId());
|
||||
if (test != null) {
|
||||
test.setName(request.getName());
|
||||
test.setCaseStatus(request.getCaseStatus());
|
||||
if (StringUtils.isEmpty(request.getCaseStatus())) {
|
||||
test.setCaseStatus(APITestStatus.Underway.name());
|
||||
}
|
||||
test.setApiDefinitionId(request.getApiDefinitionId());
|
||||
test.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||
test.setProjectId(request.getProjectId());
|
||||
|
@ -346,7 +350,8 @@ public class ApiTestCaseService {
|
|||
test.setTags(request.getTags());
|
||||
}
|
||||
apiTestCaseMapper.updateByPrimaryKeySelective(test);
|
||||
return apiTestCaseMapper.selectByPrimaryKey(request.getId());
|
||||
}
|
||||
return test;
|
||||
}
|
||||
|
||||
private ApiTestCase createTest(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
|
||||
|
@ -362,6 +367,10 @@ public class ApiTestCaseService {
|
|||
test.setId(request.getId());
|
||||
test.setName(request.getName());
|
||||
test.setStatus("");
|
||||
test.setCaseStatus(request.getCaseStatus());
|
||||
if (StringUtils.isEmpty(request.getCaseStatus())) {
|
||||
test.setCaseStatus(APITestStatus.Underway.name());
|
||||
}
|
||||
test.setApiDefinitionId(request.getApiDefinitionId());
|
||||
test.setCreateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||
test.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ApiTestCase implements Serializable {
|
||||
private String id;
|
||||
|
@ -43,5 +44,7 @@ public class ApiTestCase implements Serializable {
|
|||
|
||||
private Long order;
|
||||
|
||||
private String caseStatus;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -1373,6 +1373,76 @@ public class ApiTestCaseExample {
|
|||
addCriterion("`order` not between", value1, value2, "order");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusIsNull() {
|
||||
addCriterion("case_status is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusIsNotNull() {
|
||||
addCriterion("case_status is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusEqualTo(String value) {
|
||||
addCriterion("case_status =", value, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusNotEqualTo(String value) {
|
||||
addCriterion("case_status <>", value, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusGreaterThan(String value) {
|
||||
addCriterion("case_status >", value, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("case_status >=", value, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusLessThan(String value) {
|
||||
addCriterion("case_status <", value, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusLessThanOrEqualTo(String value) {
|
||||
addCriterion("case_status <=", value, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusLike(String value) {
|
||||
addCriterion("case_status like", value, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusNotLike(String value) {
|
||||
addCriterion("case_status not like", value, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusIn(List<String> values) {
|
||||
addCriterion("case_status in", values, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusNotIn(List<String> values) {
|
||||
addCriterion("case_status not in", values, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusBetween(String value1, String value2) {
|
||||
addCriterion("case_status between", value1, value2, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCaseStatusNotBetween(String value1, String value2) {
|
||||
addCriterion("case_status not between", value1, value2, "caseStatus");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<result column="version" jdbcType="INTEGER" property="version" />
|
||||
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
|
||||
<result column="order" jdbcType="BIGINT" property="order" />
|
||||
<result column="case_status" jdbcType="VARCHAR" property="caseStatus" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||
|
@ -87,7 +88,7 @@
|
|||
<sql id="Base_Column_List">
|
||||
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
|
||||
create_time, update_time, num, tags, last_result_id, `status`, original_status, delete_time,
|
||||
delete_user_id, version, follow_people, `order`
|
||||
delete_user_id, version, follow_people, `order`, case_status
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
description, request
|
||||
|
@ -147,16 +148,16 @@
|
|||
num, tags, last_result_id,
|
||||
`status`, original_status, delete_time,
|
||||
delete_user_id, version, follow_people,
|
||||
`order`, description, request
|
||||
)
|
||||
`order`, case_status, description,
|
||||
request)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
|
||||
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{num,jdbcType=INTEGER}, #{tags,jdbcType=VARCHAR}, #{lastResultId,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{originalStatus,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT},
|
||||
#{deleteUserId,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{followPeople,jdbcType=VARCHAR},
|
||||
#{order,jdbcType=BIGINT}, #{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
#{order,jdbcType=BIGINT}, #{caseStatus,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR},
|
||||
#{request,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||
insert into api_test_case
|
||||
|
@ -218,6 +219,9 @@
|
|||
<if test="order != null">
|
||||
`order`,
|
||||
</if>
|
||||
<if test="caseStatus != null">
|
||||
case_status,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
|
@ -283,6 +287,9 @@
|
|||
<if test="order != null">
|
||||
#{order,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="caseStatus != null">
|
||||
#{caseStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -357,6 +364,9 @@
|
|||
<if test="record.order != null">
|
||||
`order` = #{record.order,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.caseStatus != null">
|
||||
case_status = #{record.caseStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -389,6 +399,7 @@
|
|||
version = #{record.version,jdbcType=INTEGER},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
`order` = #{record.order,jdbcType=BIGINT},
|
||||
case_status = #{record.caseStatus,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
request = #{record.request,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
|
@ -415,7 +426,8 @@
|
|||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
version = #{record.version,jdbcType=INTEGER},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
`order` = #{record.order,jdbcType=BIGINT}
|
||||
`order` = #{record.order,jdbcType=BIGINT},
|
||||
case_status = #{record.caseStatus,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -477,6 +489,9 @@
|
|||
<if test="order != null">
|
||||
`order` = #{order,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="caseStatus != null">
|
||||
case_status = #{caseStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -506,6 +521,7 @@
|
|||
version = #{version,jdbcType=INTEGER},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
`order` = #{order,jdbcType=BIGINT},
|
||||
case_status = #{caseStatus,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
request = #{request,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
|
@ -529,7 +545,8 @@
|
|||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
version = #{version,jdbcType=INTEGER},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
`order` = #{order,jdbcType=BIGINT}
|
||||
`order` = #{order,jdbcType=BIGINT},
|
||||
case_status = #{caseStatus,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -242,7 +242,7 @@
|
|||
|
||||
<select id="listSimple" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO">
|
||||
select
|
||||
t1.id, t1.project_id, t1.name, t1.api_definition_id, t1.priority, t1.description, t1.create_user_id, t1.update_user_id, t1.create_time, t1.update_time, t1.num,
|
||||
t1.id, t1.project_id, t1.name,t1.case_status, t1.api_definition_id, t1.priority, t1.description, t1.create_user_id, t1.update_user_id, t1.create_time, t1.update_time, t1.num,
|
||||
a.module_id, a.path, a.protocol, t1.tags,t1.status,t1.last_result_id as lastResultId,
|
||||
t1.delete_time, deleteUser.name AS deleteUser,CONCAT(FORMAT(SUM(IF (t2.`status`='success',1,0))/COUNT(t2.id)*100,2),'%') passRate
|
||||
from
|
||||
|
@ -311,6 +311,12 @@
|
|||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="key=='caseStatus' or key=='case_status'">
|
||||
and t1.case_status in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="key=='status' and values.size == 0">
|
||||
|
|
|
@ -335,3 +335,6 @@ ALTER TABLE service_integration
|
|||
|
||||
ALTER TABLE workspace
|
||||
DROP COLUMN organization_id;
|
||||
|
||||
ALTER TABLE api_test_case ADD COLUMN case_status VARCHAR(100) comment '用例状态等同场景的status';
|
||||
UPDATE api_test_case set case_status ="Underway" where case_status is null;
|
|
@ -37,10 +37,6 @@
|
|||
<el-link type="primary" style="margin-left: 10px" @click="openHis(apiCase)" v-if="apiCase.id">{{ $t('operating_log.change_history') }}</el-link>
|
||||
</span>
|
||||
<div v-if="apiCase.id" style="color: #999999;font-size: 12px">
|
||||
<!--<span>-->
|
||||
<!--{{ apiCase.createTime | timestampFormatDate }}-->
|
||||
<!--{{ apiCase.createUser }} {{ $t('api_test.definition.request.create_info') }}-->
|
||||
<!--</span>-->
|
||||
<span style="margin-left: 10px">
|
||||
{{ apiCase.updateTime | timestampFormatDate }}
|
||||
{{ apiCase.updateUser }} {{ $t('api_test.definition.request.update_info') }}
|
||||
|
@ -58,18 +54,17 @@
|
|||
</el-tooltip>
|
||||
</span>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<div class="tag-item" @click.stop>
|
||||
<ms-input-tag :currentScenario="apiCase" ref="tag" @keyup.enter.native="saveTestCase(apiCase,true)"/>
|
||||
</div>
|
||||
<el-col :span="6">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-select size="small" v-model="apiCase.caseStatus" style="margin-right: 5px" @change="saveTestCase(apiCase,true)">
|
||||
<el-option v-for="item in options" :key="item.id" :label="$t(item.label)" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="3">
|
||||
<el-col :span="16">
|
||||
<div class="tag-item" @click.stop>
|
||||
<el-select v-model="apiCase.followPeople"
|
||||
clearable
|
||||
:placeholder="$t('api_test.automation.follow_people')" filterable size="small"
|
||||
@change="saveTestCase(apiCase,true)">
|
||||
<el-select v-model="apiCase.followPeople" clearable :placeholder="$t('api_test.automation.follow_people')" filterable size="small"
|
||||
@change="saveTestCase(apiCase,true)" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in maintainerOptions"
|
||||
:key="item.id"
|
||||
|
@ -79,6 +74,13 @@
|
|||
</el-select>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row style="margin-top: 5px">
|
||||
<div class="tag-item" @click.stop>
|
||||
<ms-input-tag :currentScenario="apiCase" ref="tag" @keyup.enter.native="saveTestCase(apiCase,true)"/>
|
||||
</div>
|
||||
</el-row>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="3">
|
||||
<span @click.stop>
|
||||
|
@ -156,7 +158,7 @@
|
|||
|
||||
<script>
|
||||
import {_getBodyUploadFiles, getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||
import {PRIORITY} from "../../model/JsonData";
|
||||
import {API_STATUS, PRIORITY} from "../../model/JsonData";
|
||||
import MsTag from "../../../../common/components/MsTag";
|
||||
import MsTipButton from "../../../../common/components/MsTipButton";
|
||||
import MsApiRequestForm from "../request/http/ApiHttpRequestForm";
|
||||
|
@ -214,6 +216,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
options: API_STATUS,
|
||||
result: {},
|
||||
grades: [],
|
||||
resultMap: new Map([
|
||||
|
|
|
@ -87,6 +87,18 @@
|
|||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
prop="caseStatus"
|
||||
:filters="STATUS_FILTERS"
|
||||
:field="item"
|
||||
:fields-width="fieldsWidth"
|
||||
min-width="120px"
|
||||
:label="$t('commons.status')">
|
||||
<template v-slot:default="scope">
|
||||
<plan-status-table-item :value="scope.row.caseStatus"/>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
|
||||
<ms-table-column
|
||||
prop="status"
|
||||
:filters="statusFilters"
|
||||
|
@ -238,6 +250,7 @@ import ApiCaseBatchRun from "@/business/components/api/definition/components/lis
|
|||
import MsRequestResultTail from "../../../../api/definition/components/response/RequestResultTail";
|
||||
import {editApiTestCaseOrder} from "@/network/api";
|
||||
import {TYPE_TO_C} from "@/business/components/api/automation/scenario/Setting";
|
||||
import i18n from "@/i18n/i18n";
|
||||
|
||||
export default {
|
||||
name: "ApiCaseSimpleList",
|
||||
|
@ -263,6 +276,7 @@ export default {
|
|||
MsTable,
|
||||
MsTableColumn,
|
||||
MsRequestResultTail,
|
||||
PlanStatusTableItem: () => import("../../../../track/common/tableItems/plan/PlanStatusTableItem"),
|
||||
MsTaskCenter: () => import("../../../../task/TaskCenter"),
|
||||
},
|
||||
data() {
|
||||
|
@ -339,6 +353,11 @@ export default {
|
|||
{text: 'P2', value: 'P2'},
|
||||
{text: 'P3', value: 'P3'}
|
||||
],
|
||||
STATUS_FILTERS: [
|
||||
{text: i18n.t('test_track.plan.plan_status_prepare'), value: 'Prepare'},
|
||||
{text: i18n.t('test_track.plan.plan_status_running'), value: 'Underway'},
|
||||
{text: i18n.t('test_track.plan.plan_status_completed'), value: 'Completed'}
|
||||
],
|
||||
statusFilters: [
|
||||
{text: this.$t('api_test.automation.success'), value: 'success'},
|
||||
{text: this.$t('api_test.automation.fail'), value: 'error'},
|
||||
|
|
|
@ -89,7 +89,7 @@ export const REVIEW_STATUS = [
|
|||
export const API_STATUS = [
|
||||
{id: 'Prepare', label: 'test_track.plan.plan_status_prepare'},
|
||||
{id: 'Underway', label: 'test_track.plan.plan_status_running'},
|
||||
{id: 'Completed', label: 'test_track.plan.plan_status_finished'}
|
||||
{id: 'Completed', label: 'test_track.plan.plan_status_completed'}
|
||||
];
|
||||
export const TEST = [
|
||||
{id: 'performance', name: '性能测试', module: 'performance'},
|
||||
|
|
|
@ -54,11 +54,12 @@ export let CUSTOM_TABLE_HEADER = {
|
|||
{id: 'priority', key: '3', label: 'test_track.case.priority'},
|
||||
{id: 'path', key: '4', label: 'api_test.definition.api_definition_path'},
|
||||
{id: 'status', key: '5', label: 'test_track.plan_view.execute_result'},
|
||||
{id: 'passRate', key: '6', label: 'commons.pass_rate'},
|
||||
{id: 'caseStatus', key: '6', label: 'commons.status'},
|
||||
{id: 'tags', key: '7', label: 'commons.tag'},
|
||||
{id: 'createUser', key: '8', label: 'api_test.creator'},
|
||||
{id: 'updateTime', key: '9', label: 'api_test.definition.api_last_time'},
|
||||
{id: 'createTime', key: 'a', label: 'commons.create_time'},
|
||||
{id: 'passRate', key: 'b', label: 'commons.pass_rate'},
|
||||
],
|
||||
//场景测试
|
||||
API_SCENARIO: [
|
||||
|
|
Loading…
Reference in New Issue