From e0a6707bfb3be7fc7f64e2f7796e280cb4f29d84 Mon Sep 17 00:00:00 2001 From: metersphere-bot <78466014+metersphere-bot@users.noreply.github.com> Date: Tue, 27 Apr 2021 11:57:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E6=AD=A5=E9=AA=A4=E6=94=AF=E6=8C=81=E4=B8=A4?= =?UTF-8?q?=E7=A7=8D=E6=A8=A1=E5=BC=8F=20(#2303)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(测试跟踪): 用例步骤支持两种模式 * fix: 用例评审步骤支持两种模式 Co-authored-by: chenjianxing Co-authored-by: jianxing <41557596+AgAngle@users.noreply.github.com> --- .../io/metersphere/base/domain/TestCase.java | 2 + .../base/domain/TestCaseExample.java | 71 +++++ .../base/domain/TestCaseTemplate.java | 2 + .../base/domain/TestCaseTemplateExample.java | 70 +++++ .../domain/TestCaseTemplateWithBLOBs.java | 2 + .../base/mapper/TestCaseMapper.xml | 35 ++- .../base/mapper/TestCaseTemplateMapper.xml | 54 +++- .../db/migration/V80__v1.9.0_release.sql | 7 +- .../src/main/resources/generatorConfig.xml | 4 +- .../workspace/template/CustomFieldEdit.vue | 12 +- .../workspace/template/FieldTemplateEdit.vue | 14 +- .../workspace/template/IssueTemplateEdit.vue | 10 +- .../template/TestCaseTemplateEdit.vue | 28 +- .../case/components/FormRichTextItem.vue | 4 +- .../track/case/components/StepChangeItem.vue | 51 ++++ .../track/case/components/TestCaseEdit.vue | 81 +++--- .../case/components/TestCaseEditOtherInfo.vue | 2 +- .../case/components/TestCaseStepItem.vue | 122 +++++++++ .../common/TestPlanTestCaseStatusButton.vue | 4 - .../functional/FunctionalTestCaseEdit.vue | 100 ++++--- .../TestPlanCaseStepResultsItem.vue | 90 +++++++ .../components/TestReviewTestCaseEdit.vue | 243 ++++-------------- frontend/src/common/js/custom_field.js | 35 +-- 23 files changed, 675 insertions(+), 368 deletions(-) create mode 100644 frontend/src/business/components/track/case/components/StepChangeItem.vue create mode 100644 frontend/src/business/components/track/case/components/TestCaseStepItem.vue create mode 100644 frontend/src/business/components/track/plan/view/comonents/functional/TestPlanCaseStepResultsItem.vue diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCase.java b/backend/src/main/java/io/metersphere/base/domain/TestCase.java index 9c18ce630d..fcd9e1eaa0 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCase.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCase.java @@ -51,5 +51,7 @@ public class TestCase implements Serializable { private String customNum; + private String stepModel; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java index 80aeb81946..bd705ebc3a 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseExample.java @@ -1673,6 +1673,77 @@ public class TestCaseExample { addCriterion("custom_num not between", value1, value2, "customNum"); return (Criteria) this; } + + public Criteria andStepModelIsNull() { + addCriterion("step_model is null"); + return (Criteria) this; + } + + public Criteria andStepModelIsNotNull() { + addCriterion("step_model is not null"); + return (Criteria) this; + } + + public Criteria andStepModelEqualTo(String value) { + addCriterion("step_model =", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelNotEqualTo(String value) { + addCriterion("step_model <>", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelGreaterThan(String value) { + addCriterion("step_model >", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelGreaterThanOrEqualTo(String value) { + addCriterion("step_model >=", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelLessThan(String value) { + addCriterion("step_model <", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelLessThanOrEqualTo(String value) { + addCriterion("step_model <=", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelLike(String value) { + addCriterion("step_model like", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelNotLike(String value) { + addCriterion("step_model not like", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelIn(List values) { + addCriterion("step_model in", values, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelNotIn(List values) { + addCriterion("step_model not in", values, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelBetween(String value1, String value2) { + addCriterion("step_model between", value1, value2, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelNotBetween(String value1, String value2) { + addCriterion("step_model not between", value1, value2, "stepModel"); + return (Criteria) this; + } + } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplate.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplate.java index 67de1cb7b0..e349cecad8 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplate.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplate.java @@ -27,5 +27,7 @@ public class TestCaseTemplate implements Serializable { private Long updateTime; + private String stepModel; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplateExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplateExample.java index c56ca7ec04..4ed41a5c67 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplateExample.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplateExample.java @@ -833,6 +833,76 @@ public class TestCaseTemplateExample { addCriterion("update_time not between", value1, value2, "updateTime"); return (Criteria) this; } + + public Criteria andStepModelIsNull() { + addCriterion("step_model is null"); + return (Criteria) this; + } + + public Criteria andStepModelIsNotNull() { + addCriterion("step_model is not null"); + return (Criteria) this; + } + + public Criteria andStepModelEqualTo(String value) { + addCriterion("step_model =", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelNotEqualTo(String value) { + addCriterion("step_model <>", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelGreaterThan(String value) { + addCriterion("step_model >", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelGreaterThanOrEqualTo(String value) { + addCriterion("step_model >=", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelLessThan(String value) { + addCriterion("step_model <", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelLessThanOrEqualTo(String value) { + addCriterion("step_model <=", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelLike(String value) { + addCriterion("step_model like", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelNotLike(String value) { + addCriterion("step_model not like", value, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelIn(List values) { + addCriterion("step_model in", values, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelNotIn(List values) { + addCriterion("step_model not in", values, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelBetween(String value1, String value2) { + addCriterion("step_model between", value1, value2, "stepModel"); + return (Criteria) this; + } + + public Criteria andStepModelNotBetween(String value1, String value2) { + addCriterion("step_model not between", value1, value2, "stepModel"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplateWithBLOBs.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplateWithBLOBs.java index 27737194ef..e3234f1c87 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplateWithBLOBs.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseTemplateWithBLOBs.java @@ -15,5 +15,7 @@ public class TestCaseTemplateWithBLOBs extends TestCaseTemplate implements Seria private String actualResult; + private String steps; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml index 2bfeb8402e..ad2c420971 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml @@ -25,6 +25,7 @@ + @@ -94,7 +95,7 @@ id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`, prerequisite, create_time, update_time, test_id, sort, num, other_test_name, review_status, - tags, demand_id, demand_name, follow_people, `status`, custom_num + tags, demand_id, demand_name, follow_people, `status`, custom_num, step_model remark, steps, step_description, expected_result, custom_fields @@ -155,9 +156,9 @@ test_id, sort, num, other_test_name, review_status, tags, demand_id, demand_name, follow_people, - `status`, custom_num, remark, - steps, step_description, expected_result, - custom_fields) + `status`, custom_num, step_model, + remark, steps, step_description, + expected_result, custom_fields) 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}, @@ -165,9 +166,9 @@ #{testId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, #{otherTestName,jdbcType=VARCHAR}, #{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR}, #{demandName,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR}, - #{status,jdbcType=VARCHAR}, #{customNum,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR}, - #{steps,jdbcType=LONGVARCHAR}, #{stepDescription,jdbcType=LONGVARCHAR}, #{expectedResult,jdbcType=LONGVARCHAR}, - #{customFields,jdbcType=LONGVARCHAR}) + #{status,jdbcType=VARCHAR}, #{customNum,jdbcType=VARCHAR}, #{stepModel,jdbcType=VARCHAR}, + #{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR}, #{stepDescription,jdbcType=LONGVARCHAR}, + #{expectedResult,jdbcType=LONGVARCHAR}, #{customFields,jdbcType=LONGVARCHAR}) insert into test_case @@ -241,6 +242,9 @@ custom_num, + + step_model, + remark, @@ -327,6 +331,9 @@ #{customNum,jdbcType=VARCHAR}, + + #{stepModel,jdbcType=VARCHAR}, + #{remark,jdbcType=LONGVARCHAR}, @@ -422,6 +429,9 @@ custom_num = #{record.customNum,jdbcType=VARCHAR}, + + step_model = #{record.stepModel,jdbcType=VARCHAR}, + remark = #{record.remark,jdbcType=LONGVARCHAR}, @@ -467,6 +477,7 @@ follow_people = #{record.followPeople,jdbcType=VARCHAR}, `status` = #{record.status,jdbcType=VARCHAR}, custom_num = #{record.customNum,jdbcType=VARCHAR}, + step_model = #{record.stepModel,jdbcType=VARCHAR}, remark = #{record.remark,jdbcType=LONGVARCHAR}, steps = #{record.steps,jdbcType=LONGVARCHAR}, step_description = #{record.stepDescription,jdbcType=LONGVARCHAR}, @@ -500,7 +511,8 @@ demand_name = #{record.demandName,jdbcType=VARCHAR}, follow_people = #{record.followPeople,jdbcType=VARCHAR}, `status` = #{record.status,jdbcType=VARCHAR}, - custom_num = #{record.customNum,jdbcType=VARCHAR} + custom_num = #{record.customNum,jdbcType=VARCHAR}, + step_model = #{record.stepModel,jdbcType=VARCHAR} @@ -574,6 +586,9 @@ custom_num = #{customNum,jdbcType=VARCHAR}, + + step_model = #{stepModel,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=LONGVARCHAR}, @@ -616,6 +631,7 @@ follow_people = #{followPeople,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR}, custom_num = #{customNum,jdbcType=VARCHAR}, + step_model = #{stepModel,jdbcType=VARCHAR}, remark = #{remark,jdbcType=LONGVARCHAR}, steps = #{steps,jdbcType=LONGVARCHAR}, step_description = #{stepDescription,jdbcType=LONGVARCHAR}, @@ -646,7 +662,8 @@ demand_name = #{demandName,jdbcType=VARCHAR}, follow_people = #{followPeople,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR}, - custom_num = #{customNum,jdbcType=VARCHAR} + custom_num = #{customNum,jdbcType=VARCHAR}, + step_model = #{stepModel,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTemplateMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTemplateMapper.xml index 399708b53d..fccaff38d1 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTemplateMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTemplateMapper.xml @@ -13,11 +13,13 @@ + + @@ -79,10 +81,10 @@ id, `name`, `type`, description, case_name, `system`, `global`, workspace_id, prerequisite, - create_time, update_time + create_time, update_time, step_model - step_description, expected_result, actual_result + step_description, expected_result, actual_result, steps @@ -277,6 +293,9 @@ update_time = #{record.updateTime,jdbcType=BIGINT}, + + step_model = #{record.stepModel,jdbcType=VARCHAR}, + step_description = #{record.stepDescription,jdbcType=LONGVARCHAR}, @@ -286,6 +305,9 @@ actual_result = #{record.actualResult,jdbcType=LONGVARCHAR}, + + steps = #{record.steps,jdbcType=LONGVARCHAR}, + @@ -304,9 +326,11 @@ prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT}, + step_model = #{record.stepModel,jdbcType=VARCHAR}, step_description = #{record.stepDescription,jdbcType=LONGVARCHAR}, expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR}, - actual_result = #{record.actualResult,jdbcType=LONGVARCHAR} + actual_result = #{record.actualResult,jdbcType=LONGVARCHAR}, + steps = #{record.steps,jdbcType=LONGVARCHAR} @@ -323,7 +347,8 @@ workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT} + update_time = #{record.updateTime,jdbcType=BIGINT}, + step_model = #{record.stepModel,jdbcType=VARCHAR} @@ -361,6 +386,9 @@ update_time = #{updateTime,jdbcType=BIGINT}, + + step_model = #{stepModel,jdbcType=VARCHAR}, + step_description = #{stepDescription,jdbcType=LONGVARCHAR}, @@ -370,6 +398,9 @@ actual_result = #{actualResult,jdbcType=LONGVARCHAR}, + + steps = #{steps,jdbcType=LONGVARCHAR}, + where id = #{id,jdbcType=VARCHAR} @@ -385,9 +416,11 @@ prerequisite = #{prerequisite,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT}, + step_model = #{stepModel,jdbcType=VARCHAR}, step_description = #{stepDescription,jdbcType=LONGVARCHAR}, expected_result = #{expectedResult,jdbcType=LONGVARCHAR}, - actual_result = #{actualResult,jdbcType=LONGVARCHAR} + actual_result = #{actualResult,jdbcType=LONGVARCHAR}, + steps = #{steps,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=VARCHAR} @@ -401,7 +434,8 @@ workspace_id = #{workspaceId,jdbcType=VARCHAR}, prerequisite = #{prerequisite,jdbcType=VARCHAR}, create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT} + update_time = #{updateTime,jdbcType=BIGINT}, + step_model = #{stepModel,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/resources/db/migration/V80__v1.9.0_release.sql b/backend/src/main/resources/db/migration/V80__v1.9.0_release.sql index 9a71a44532..92f04c4502 100644 --- a/backend/src/main/resources/db/migration/V80__v1.9.0_release.sql +++ b/backend/src/main/resources/db/migration/V80__v1.9.0_release.sql @@ -243,6 +243,11 @@ alter table load_test_report ALTER TABLE issue_template MODIFY COLUMN title varchar(64) NULL COMMENT 'Issue title'; ALTER TABLE test_case_template MODIFY COLUMN case_name varchar(64) NULL COMMENT 'Test Case Name'; +-- 用例步骤支持两种编辑模式 +ALTER TABLE test_case_template ADD step_model varchar(10) NULL COMMENT 'Step model'; +ALTER TABLE test_case_template ADD steps TEXT NULL COMMENT 'Test case step'; +ALTER TABLE test_case ADD step_model varchar(10) NULL COMMENT 'Test case step model'; + -- 去掉测试方式 UPDATE system_header SET props='[{"id":"num","label":"ID"},{"id":"name","label":"名称"},{"id":"priority","label":"用例等级"},{"id":"type","label":"类型"},{"id":"tags","label":"标签"},{"id":"nodePath","label":"所属模块"},{"id":"projectName","label":"所属项目"},{"id":"issuesContent","label":"缺陷"},{"id":"executorName","label":"执行人"},{"id":"status","label":"执行结果"},{"id":"updateTime","label":"更新时间"},{"id":"maintainer","label":"责任人"}]' @@ -250,4 +255,4 @@ WHERE `type`='test_plan_function_test_case'; -- 自定义用例ID alter table project add custom_num tinyint(1) default 0 null comment '是否开启自定义ID(默认关闭)'; -alter table test_case add custom_num varchar(64) null comment 'custom num'; \ No newline at end of file +alter table test_case add custom_num varchar(64) null comment 'custom num'; diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index ca4db23830..e0015551c4 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -77,10 +77,10 @@
--> - +
-
+
diff --git a/frontend/src/business/components/settings/workspace/template/CustomFieldEdit.vue b/frontend/src/business/components/settings/workspace/template/CustomFieldEdit.vue index 8fc386896b..a145aa1212 100644 --- a/frontend/src/business/components/settings/workspace/template/CustomFieldEdit.vue +++ b/frontend/src/business/components/settings/workspace/template/CustomFieldEdit.vue @@ -8,16 +8,16 @@ ref="msEditDialog"> - + - + - + - + + prop="options" :label-width="labelWidth"> @@ -60,7 +60,7 @@ import {CUSTOM_FIELD_SCENE_OPTION, CUSTOM_FIELD_TYPE_OPTION, SYSTEM_FIELD_NAME_M export default { name: "CustomFieldEdit", components: {MsSingleHandleDrag, MsEditDialog}, - props: ['scene'], + props: ['scene','labelWidth'], data() { return { form: { diff --git a/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue b/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue index c9730d3a33..b6388e6667 100644 --- a/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue +++ b/frontend/src/business/components/settings/workspace/template/FieldTemplateEdit.vue @@ -18,13 +18,13 @@ - + - + @@ -32,12 +32,12 @@ - + 添加字段 设置自定义字段 - + - + @@ -102,6 +102,7 @@ export default { scene: String, url:String, rules: Object, + labelWidth: String, form:{ type: Object, default() { @@ -138,6 +139,9 @@ export default { if (valid) { let param = {}; Object.assign(param, this.form); + if (this.form.steps) { + param.steps = JSON.stringify(this.form.steps); + } param.options = JSON.stringify(this.form.options); param.workspaceId = getCurrentWorkspaceId(); let customFields = this.relateFields; diff --git a/frontend/src/business/components/settings/workspace/template/IssueTemplateEdit.vue b/frontend/src/business/components/settings/workspace/template/IssueTemplateEdit.vue index dd094eb5bd..bdd4ae410a 100644 --- a/frontend/src/business/components/settings/workspace/template/IssueTemplateEdit.vue +++ b/frontend/src/business/components/settings/workspace/template/IssueTemplateEdit.vue @@ -1,6 +1,7 @@