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 0ad81ca190..07750e2480 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCase.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCase.java @@ -1,8 +1,7 @@ package io.metersphere.base.domain; -import lombok.Data; - import java.io.Serializable; +import lombok.Data; @Data public class TestCase implements Serializable { @@ -10,6 +9,8 @@ public class TestCase implements Serializable { private String nodeId; + private String testId; + private String nodePath; private String projectId; @@ -30,8 +31,6 @@ public class TestCase implements Serializable { private Long updateTime; - private String testId; - private Integer sort; private Integer num; diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseWithBLOBs.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseWithBLOBs.java index 49fe510c41..310222b8d7 100644 --- a/backend/src/main/java/io/metersphere/base/domain/TestCaseWithBLOBs.java +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseWithBLOBs.java @@ -1,18 +1,21 @@ package io.metersphere.base.domain; +import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.io.Serializable; - @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class TestCaseWithBLOBs extends TestCase implements Serializable { private String remark; - private String steps; //与TestCaseExcelData里的属性名不一致,BeanUtils.copyBean()复制不了值,需要手动赋值 + private String steps; + + private String stepDescription; + + private String expectedResult; 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 59d8833db3..ec180a3807 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseMapper.xml @@ -2,32 +2,34 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -88,12 +90,12 @@ - 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, + id, node_id, test_id, node_path, project_id, `name`, `type`, maintainer, priority, + `method`, prerequisite, create_time, update_time, sort, num, other_test_name, review_status, tags, demand_id, demand_name, follow_people, `status` - remark, steps + remark, steps, step_description, expected_result @@ -327,6 +345,9 @@ node_id = #{record.nodeId,jdbcType=VARCHAR}, + + test_id = #{record.testId,jdbcType=VARCHAR}, + node_path = #{record.nodePath,jdbcType=VARCHAR}, @@ -357,9 +378,6 @@ update_time = #{record.updateTime,jdbcType=BIGINT}, - - test_id = #{record.testId,jdbcType=VARCHAR}, - sort = #{record.sort,jdbcType=INTEGER}, @@ -393,6 +411,12 @@ steps = #{record.steps,jdbcType=LONGVARCHAR}, + + step_description = #{record.stepDescription,jdbcType=LONGVARCHAR}, + + + expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR}, + @@ -401,29 +425,31 @@ update test_case set id = #{record.id,jdbcType=VARCHAR}, - node_id = #{record.nodeId,jdbcType=VARCHAR}, - node_path = #{record.nodePath,jdbcType=VARCHAR}, - project_id = #{record.projectId,jdbcType=VARCHAR}, - `name` = #{record.name,jdbcType=VARCHAR}, - `type` = #{record.type,jdbcType=VARCHAR}, - maintainer = #{record.maintainer,jdbcType=VARCHAR}, - priority = #{record.priority,jdbcType=VARCHAR}, - `method` = #{record.method,jdbcType=VARCHAR}, - prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - test_id = #{record.testId,jdbcType=VARCHAR}, - sort = #{record.sort,jdbcType=INTEGER}, - num = #{record.num,jdbcType=INTEGER}, - other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, - review_status = #{record.reviewStatus,jdbcType=VARCHAR}, - tags = #{record.tags,jdbcType=VARCHAR}, - demand_id = #{record.demandId,jdbcType=VARCHAR}, - demand_name = #{record.demandName,jdbcType=VARCHAR}, - follow_people = #{record.followPeople,jdbcType=VARCHAR}, - `status` = #{record.status,jdbcType=VARCHAR}, - remark = #{record.remark,jdbcType=LONGVARCHAR}, - steps = #{record.steps,jdbcType=LONGVARCHAR} + node_id = #{record.nodeId,jdbcType=VARCHAR}, + test_id = #{record.testId,jdbcType=VARCHAR}, + node_path = #{record.nodePath,jdbcType=VARCHAR}, + project_id = #{record.projectId,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, + `type` = #{record.type,jdbcType=VARCHAR}, + maintainer = #{record.maintainer,jdbcType=VARCHAR}, + priority = #{record.priority,jdbcType=VARCHAR}, + `method` = #{record.method,jdbcType=VARCHAR}, + prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + sort = #{record.sort,jdbcType=INTEGER}, + num = #{record.num,jdbcType=INTEGER}, + other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, + review_status = #{record.reviewStatus,jdbcType=VARCHAR}, + tags = #{record.tags,jdbcType=VARCHAR}, + demand_id = #{record.demandId,jdbcType=VARCHAR}, + demand_name = #{record.demandName,jdbcType=VARCHAR}, + follow_people = #{record.followPeople,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=VARCHAR}, + remark = #{record.remark,jdbcType=LONGVARCHAR}, + steps = #{record.steps,jdbcType=LONGVARCHAR}, + step_description = #{record.stepDescription,jdbcType=LONGVARCHAR}, + expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR} @@ -431,27 +457,27 @@ update test_case set id = #{record.id,jdbcType=VARCHAR}, - node_id = #{record.nodeId,jdbcType=VARCHAR}, - node_path = #{record.nodePath,jdbcType=VARCHAR}, - project_id = #{record.projectId,jdbcType=VARCHAR}, - `name` = #{record.name,jdbcType=VARCHAR}, - `type` = #{record.type,jdbcType=VARCHAR}, - maintainer = #{record.maintainer,jdbcType=VARCHAR}, - priority = #{record.priority,jdbcType=VARCHAR}, - `method` = #{record.method,jdbcType=VARCHAR}, - prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - test_id = #{record.testId,jdbcType=VARCHAR}, - sort = #{record.sort,jdbcType=INTEGER}, - num = #{record.num,jdbcType=INTEGER}, - other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, - review_status = #{record.reviewStatus,jdbcType=VARCHAR}, - tags = #{record.tags,jdbcType=VARCHAR}, - demand_id = #{record.demandId,jdbcType=VARCHAR}, - demand_name = #{record.demandName,jdbcType=VARCHAR}, - follow_people = #{record.followPeople,jdbcType=VARCHAR}, - `status` = #{record.status,jdbcType=VARCHAR} + node_id = #{record.nodeId,jdbcType=VARCHAR}, + test_id = #{record.testId,jdbcType=VARCHAR}, + node_path = #{record.nodePath,jdbcType=VARCHAR}, + project_id = #{record.projectId,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, + `type` = #{record.type,jdbcType=VARCHAR}, + maintainer = #{record.maintainer,jdbcType=VARCHAR}, + priority = #{record.priority,jdbcType=VARCHAR}, + `method` = #{record.method,jdbcType=VARCHAR}, + prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + sort = #{record.sort,jdbcType=INTEGER}, + num = #{record.num,jdbcType=INTEGER}, + other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, + review_status = #{record.reviewStatus,jdbcType=VARCHAR}, + tags = #{record.tags,jdbcType=VARCHAR}, + demand_id = #{record.demandId,jdbcType=VARCHAR}, + demand_name = #{record.demandName,jdbcType=VARCHAR}, + follow_people = #{record.followPeople,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=VARCHAR} @@ -462,6 +488,9 @@ node_id = #{nodeId,jdbcType=VARCHAR}, + + test_id = #{testId,jdbcType=VARCHAR}, + node_path = #{nodePath,jdbcType=VARCHAR}, @@ -492,9 +521,6 @@ update_time = #{updateTime,jdbcType=BIGINT}, - - test_id = #{testId,jdbcType=VARCHAR}, - sort = #{sort,jdbcType=INTEGER}, @@ -528,59 +554,67 @@ steps = #{steps,jdbcType=LONGVARCHAR}, + + step_description = #{stepDescription,jdbcType=LONGVARCHAR}, + + + expected_result = #{expectedResult,jdbcType=LONGVARCHAR}, + where id = #{id,jdbcType=VARCHAR} update test_case - set node_id = #{nodeId,jdbcType=VARCHAR}, - node_path = #{nodePath,jdbcType=VARCHAR}, - project_id = #{projectId,jdbcType=VARCHAR}, - `name` = #{name,jdbcType=VARCHAR}, - `type` = #{type,jdbcType=VARCHAR}, - maintainer = #{maintainer,jdbcType=VARCHAR}, - priority = #{priority,jdbcType=VARCHAR}, - `method` = #{method,jdbcType=VARCHAR}, - prerequisite = #{prerequisite,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - test_id = #{testId,jdbcType=VARCHAR}, - sort = #{sort,jdbcType=INTEGER}, - num = #{num,jdbcType=INTEGER}, - other_test_name = #{otherTestName,jdbcType=VARCHAR}, - review_status = #{reviewStatus,jdbcType=VARCHAR}, - tags = #{tags,jdbcType=VARCHAR}, - demand_id = #{demandId,jdbcType=VARCHAR}, - demand_name = #{demandName,jdbcType=VARCHAR}, - follow_people = #{followPeople,jdbcType=VARCHAR}, - `status` = #{status,jdbcType=VARCHAR}, - remark = #{remark,jdbcType=LONGVARCHAR}, - steps = #{steps,jdbcType=LONGVARCHAR} + set node_id = #{nodeId,jdbcType=VARCHAR}, + test_id = #{testId,jdbcType=VARCHAR}, + node_path = #{nodePath,jdbcType=VARCHAR}, + project_id = #{projectId,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + maintainer = #{maintainer,jdbcType=VARCHAR}, + priority = #{priority,jdbcType=VARCHAR}, + `method` = #{method,jdbcType=VARCHAR}, + prerequisite = #{prerequisite,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + sort = #{sort,jdbcType=INTEGER}, + num = #{num,jdbcType=INTEGER}, + other_test_name = #{otherTestName,jdbcType=VARCHAR}, + review_status = #{reviewStatus,jdbcType=VARCHAR}, + tags = #{tags,jdbcType=VARCHAR}, + demand_id = #{demandId,jdbcType=VARCHAR}, + demand_name = #{demandName,jdbcType=VARCHAR}, + follow_people = #{followPeople,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + remark = #{remark,jdbcType=LONGVARCHAR}, + steps = #{steps,jdbcType=LONGVARCHAR}, + step_description = #{stepDescription,jdbcType=LONGVARCHAR}, + expected_result = #{expectedResult,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=VARCHAR} update test_case - set node_id = #{nodeId,jdbcType=VARCHAR}, - node_path = #{nodePath,jdbcType=VARCHAR}, - project_id = #{projectId,jdbcType=VARCHAR}, - `name` = #{name,jdbcType=VARCHAR}, - `type` = #{type,jdbcType=VARCHAR}, - maintainer = #{maintainer,jdbcType=VARCHAR}, - priority = #{priority,jdbcType=VARCHAR}, - `method` = #{method,jdbcType=VARCHAR}, - prerequisite = #{prerequisite,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - test_id = #{testId,jdbcType=VARCHAR}, - sort = #{sort,jdbcType=INTEGER}, - num = #{num,jdbcType=INTEGER}, - other_test_name = #{otherTestName,jdbcType=VARCHAR}, - review_status = #{reviewStatus,jdbcType=VARCHAR}, - tags = #{tags,jdbcType=VARCHAR}, - demand_id = #{demandId,jdbcType=VARCHAR}, - demand_name = #{demandName,jdbcType=VARCHAR}, - follow_people = #{followPeople,jdbcType=VARCHAR}, - `status` = #{status,jdbcType=VARCHAR} + set node_id = #{nodeId,jdbcType=VARCHAR}, + test_id = #{testId,jdbcType=VARCHAR}, + node_path = #{nodePath,jdbcType=VARCHAR}, + project_id = #{projectId,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + maintainer = #{maintainer,jdbcType=VARCHAR}, + priority = #{priority,jdbcType=VARCHAR}, + `method` = #{method,jdbcType=VARCHAR}, + prerequisite = #{prerequisite,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + sort = #{sort,jdbcType=INTEGER}, + num = #{num,jdbcType=INTEGER}, + other_test_name = #{otherTestName,jdbcType=VARCHAR}, + review_status = #{reviewStatus,jdbcType=VARCHAR}, + tags = #{tags,jdbcType=VARCHAR}, + demand_id = #{demandId,jdbcType=VARCHAR}, + demand_name = #{demandName,jdbcType=VARCHAR}, + follow_people = #{followPeople,jdbcType=VARCHAR}, + `status` = #{status,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 new file mode 100644 index 0000000000..181ab069dd --- /dev/null +++ b/backend/src/main/resources/db/migration/V80__v1.9.0_release.sql @@ -0,0 +1,5 @@ +-- add test_case +alter table test_case + add step_description text null; +alter table test_case + add expected_result text null; \ No newline at end of file diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 554b19d205..6ca2308ed3 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -112,7 +112,6 @@ - 步骤信息 - {{ $t('test_track.case.prerequisite') }}: - - - - + {{ $t('test_track.case.prerequisite') }}: + + + + - - {{ $t('test_track.case.steps') }}: - - - - - - - - - - - - - + + {{ $t('test_track.case.step_desc') }}: + + + + - - {{ $t('commons.remark') }}: - - - - + + {{ $t('test_track.case.expected_results') }}: + + + +
其他信息
+ - {{ $t('test_track.case.attachment') }}: - - - - - - {{ $t('test_track.case.upload_tip') }} - - - - - - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + 关联缺陷 + + + + + + {{ $t('test_track.case.upload_tip') }} + + + + + + + + + +
+ {{ $t('test_track.review.comment') }}: @@ -293,6 +265,7 @@ import ReviewCommentItem from "@/business/components/track/review/commom/ReviewC import {API_STATUS, REVIEW_STATUS, TEST} from "@/business/components/api/definition/model/JsonData"; import MsTableButton from "@/business/components/common/components/MsTableButton"; import MsSelectTree from "../../../common/select-tree/SelectTree"; +import MsTestCaseStepRichText from "./TestCaseStepRichText"; export default { name: "TestCaseEdit", @@ -300,7 +273,8 @@ export default { MsTableButton, MsSelectTree, ReviewCommentItem, - TestCaseComment, MsPreviousNextButton, MsInputTag, CaseComment, MsDialogFooter, TestCaseAttachment + TestCaseComment, MsPreviousNextButton, MsInputTag, CaseComment, MsDialogFooter, TestCaseAttachment, + MsTestCaseStepRichText }, data() { return { @@ -331,6 +305,8 @@ export default { desc: '', result: '' }], + stepDesc: '', + stepResult: '', selected: [], remark: '', tags: [], @@ -360,6 +336,7 @@ export default { prerequisite: [{max: 500, message: this.$t('test_track.length_less_than') + '500', trigger: 'blur'}], remark: [{max: 1000, message: this.$t('test_track.length_less_than') + '1000', trigger: 'blur'}] }, + tabActiveName: "remark", formLabelWidth: "120px", operationType: '', isCreateContinue: false, @@ -663,12 +640,25 @@ export default { let tmp = {}; Object.assign(tmp, testCase); tmp.steps = JSON.parse(testCase.steps); - if (tmp.steps == null) { - tmp.steps = [{ - num: 1, - desc: '', - result: '' - }]; + if(testCase.expectedResult != null) { // 改成富文本后加入的新数据 或 经过兼容的旧数据 + tmp.stepResult = testCase.expectedResult + '
'; + } else { // 如果是旧数据 + if(tmp.steps != null) { + tmp.stepResult = ''; + tmp.steps.forEach(item => { + tmp.stepResult += item.num + ': ' + item.result + '
'; + }); + } + } + if(testCase.stepDescription != null) { + tmp.stepDesc = testCase.stepDescription + '
'; + } else { + if(tmp.steps != null) { + tmp.stepDesc = ''; + tmp.steps.forEach(item => { + tmp.stepDesc += item.num + ': ' + item.desc + '
'; + }); + } } tmp.tags = JSON.parse(tmp.tags); Object.assign(this.form, tmp); @@ -785,7 +775,9 @@ export default { buildParam() { let param = {}; Object.assign(param, this.form); - param.steps = JSON.stringify(this.form.steps); + param.steps = null; // 旧数据搬运到新字段后,不再用到,置空便于判断 + param.expectedResult = this.form.stepResult; + param.stepDescription = this.form.stepDesc; // 设置数据到新字段 param.nodeId = this.form.module; param.nodePath = getNodePath(this.form.module, this.moduleOptions); if (this.projectId) { @@ -841,12 +833,14 @@ export default { }; }, validate(param) { - for (let i = 0; i < param.steps.length; i++) { - if ((param.steps[i].desc && param.steps[i].desc.length > 300) || - (param.steps[i].result && param.steps[i].result.length > 300)) { - this.$warning(this.$t('test_track.case.step_desc') + "," - + this.$t('test_track.case.expected_results') + this.$t('test_track.length_less_than') + '300'); - return false; + if(param.steps != null) { + for (let i = 0; i < param.steps.length; i++) { + if ((param.steps[i].desc && param.steps[i].desc.length > 300) || + (param.steps[i].result && param.steps[i].result.length > 300)) { + this.$warning(this.$t('test_track.case.step_desc') + "," + + this.$t('test_track.case.expectedResults') + this.$t('test_track.length_less_than') + '300'); + return false; + } } } if (param.name == '') { @@ -1013,6 +1007,18 @@ export default { createCtrlSHandle(event) { handleCtrlSEvent(event, this.saveCase); }, + updateExpectRes(text) { + this.form.stepResult = text; + }, + updateStepDesc(text) { + this.form.stepDesc = text; + }, + updatePrerequisite(text) { + this.form.prerequisite = text; + }, + updateRemark(text) { + this.form.remark = text; + }, } } diff --git a/frontend/src/business/components/track/case/components/TestCaseStepRichText.vue b/frontend/src/business/components/track/case/components/TestCaseStepRichText.vue new file mode 100644 index 0000000000..fa9bc2730c --- /dev/null +++ b/frontend/src/business/components/track/case/components/TestCaseStepRichText.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index bf3fc98aa6..5b23b797b4 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -1196,7 +1196,7 @@ export default { steps: "Steps", number: "Number", prerequisite: "Prerequisite", - step_desc: "Step describe", + step_desc: "Case step", expected_results: "Expected results", input_name: "Please enter name", input_module: "Please select module", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index ccfe1f13d6..a2e2ac56a8 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -1200,7 +1200,7 @@ export default { steps: "执行步骤", number: "编号", prerequisite: "前置条件", - step_desc: "步骤描述", + step_desc: "用例步骤", expected_results: "预期结果", input_name: "请输入名称", input_module: "请选择模块", diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 73e0bd20fd..2d086761a7 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -1198,7 +1198,7 @@ export default { steps: "執行步驟", number: "編號", prerequisite: "前置條件", - step_desc: "步驟描述", + step_desc: "用例步驟", expected_results: "預期結果", input_name: "請輸入名稱", input_module: "請選擇模塊",