diff --git a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelData.java b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelData.java index 8c344e6e3f..161486e0fc 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelData.java +++ b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelData.java @@ -20,8 +20,8 @@ public class TestCaseExcelData { private String priority; @ExcelIgnore private String tags; - @ExcelIgnore - private String method; +// @ExcelIgnore +// private String method; @ExcelIgnore private String prerequisite; @ExcelIgnore diff --git a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataCn.java b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataCn.java index 847dcd845e..218a59e01e 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataCn.java +++ b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataCn.java @@ -45,10 +45,10 @@ public class TestCaseExcelDataCn extends TestCaseExcelData { @Length(min = 0, max = 1000) private String tags; - @NotBlank(message = "{cannot_be_null}") - @ExcelProperty("测试方式") - @Pattern(regexp = "(^manual$)|(^auto$)", message = "{test_case_method_validate}") - private String method; +// @NotBlank(message = "{cannot_be_null}") +// @ExcelProperty("测试方式") +// @Pattern(regexp = "(^manual$)|(^auto$)", message = "{test_case_method_validate}") +// private String method; @ColumnWidth(50) @ExcelProperty("前置条件") diff --git a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataTw.java b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataTw.java index 4137f4e76c..d60c24fa2a 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataTw.java +++ b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataTw.java @@ -45,10 +45,10 @@ public class TestCaseExcelDataTw extends TestCaseExcelData { @Length(min = 0, max = 1000) private String tags; - @NotBlank(message = "{cannot_be_null}") - @ExcelProperty("測試方式") - @Pattern(regexp = "(^manual$)|(^auto$)", message = "{test_case_method_validate}") - private String method; +// @NotBlank(message = "{cannot_be_null}") +// @ExcelProperty("測試方式") +// @Pattern(regexp = "(^manual$)|(^auto$)", message = "{test_case_method_validate}") +// private String method; @ColumnWidth(50) @ExcelProperty("前置條件") diff --git a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataUs.java b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataUs.java index 1795d0545a..6916c3a5ec 100644 --- a/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataUs.java +++ b/backend/src/main/java/io/metersphere/excel/domain/TestCaseExcelDataUs.java @@ -46,10 +46,10 @@ public class TestCaseExcelDataUs extends TestCaseExcelData { @Length(min = 0, max = 1000) private String tags; - @NotBlank(message = "{cannot_be_null}") - @ExcelProperty("Method") - @Pattern(regexp = "(^manual$)|(^auto$)", message = "{test_case_method_validate}") - private String method; +// @NotBlank(message = "{cannot_be_null}") +// @ExcelProperty("Method") +// @Pattern(regexp = "(^manual$)|(^auto$)", message = "{test_case_method_validate}") +// private String method; @ColumnWidth(50) @ExcelProperty("Prerequisite") diff --git a/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java b/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java index 6ec7448a8f..0e5bf1d6ae 100644 --- a/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java +++ b/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java @@ -53,9 +53,9 @@ public class TestCaseDataListener extends EasyExcelListener { } } - if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) { - stringBuilder.append(Translator.get("functional_method_tip") + "; "); - } +// if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) { +// stringBuilder.append(Translator.get("functional_method_tip") + "; "); +// } if (!userIds.contains(data.getMaintainer())) { stringBuilder.append(Translator.get("user_not_exists") + ":" + data.getMaintainer() + "; "); diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 808fda0cc8..85e342970a 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -131,8 +131,8 @@ public class TestCaseService { .andNodePathEqualTo(testCase.getNodePath()) .andTypeEqualTo(testCase.getType()) .andMaintainerEqualTo(testCase.getMaintainer()) - .andPriorityEqualTo(testCase.getPriority()) - .andMethodEqualTo(testCase.getMethod()); + .andPriorityEqualTo(testCase.getPriority()); +// .andMethodEqualTo(testCase.getMethod()); // if (StringUtils.isNotBlank(testCase.getNodeId())) { // criteria.andNodeIdEqualTo(testCase.getTestId()); @@ -432,7 +432,7 @@ public class TestCaseService { List list = new ArrayList<>(); StringBuilder path = new StringBuilder(""); List types = TestCaseConstants.Type.getValues(); - List methods = TestCaseConstants.Method.getValues(); +// List methods = TestCaseConstants.Method.getValues(); SessionUser user = SessionUtils.getUser(); for (int i = 1; i <= 5; i++) { TestCaseExcelData data = new TestCaseExcelData(); @@ -442,11 +442,11 @@ public class TestCaseService { data.setPriority("P" + i % 4); String type = types.get(i % 3); data.setType(type); - if (StringUtils.equals(TestCaseConstants.Type.Functional.getValue(), type)) { - data.setMethod(TestCaseConstants.Method.Manual.getValue()); - } else { - data.setMethod(methods.get(i % 2)); - } +// if (StringUtils.equals(TestCaseConstants.Type.Functional.getValue(), type)) { +// data.setMethod(TestCaseConstants.Method.Manual.getValue()); +// } else { +// data.setMethod(methods.get(i % 2)); +// } data.setPrerequisite(Translator.get("preconditions_optional")); data.setStepDesc("1. " + Translator.get("step_tip_separate") + "\n2. " + Translator.get("step_tip_order") + "\n3. " + Translator.get("step_tip_optional")); @@ -461,7 +461,7 @@ public class TestCaseService { explain.setName(Translator.get("do_not_modify_header_order")); explain.setNodePath(Translator.get("module_created_automatically")); explain.setType(Translator.get("options") + "(functional、performance、api)"); - explain.setMethod(Translator.get("options") + "(manual、auto)"); +// explain.setMethod(Translator.get("options") + "(manual、auto)"); explain.setPriority(Translator.get("options") + "(P0、P1、P2、P3)"); explain.setMaintainer(Translator.get("please_input_workspace_member")); @@ -483,7 +483,11 @@ public class TestCaseService { private List generateTestCaseExcel(TestCaseBatchRequest request) { ServiceUtils.getSelectAllIds(request, request.getCondition(), (query) -> extTestCaseMapper.selectIds(query)); - List orderList = ServiceUtils.getDefaultOrder(request.getOrders()); + QueryTestCaseRequest condition = request.getCondition(); + List orderList = new ArrayList<>(); + if (condition != null) { + orderList = ServiceUtils.getDefaultOrder(condition.getOrders()); + } OrderRequest order = new OrderRequest(); order.setName("sort"); order.setType("desc"); @@ -499,10 +503,10 @@ public class TestCaseService { data.setNodePath(t.getNodePath()); data.setPriority(t.getPriority()); data.setType(t.getType()); - data.setMethod(t.getMethod()); +// data.setMethod(t.getMethod()); data.setPrerequisite(t.getPrerequisite()); data.setTags(t.getTags()); - if (t.getMethod().equals("manual")) { + if (StringUtils.equals(t.getMethod(), "manual") || StringUtils.isBlank(t.getMethod())) { String steps = t.getSteps(); String setp = ""; setp = steps; @@ -530,19 +534,19 @@ public class TestCaseService { result.setLength(0); data.setRemark(t.getRemark()); - } else if (t.getMethod().equals("auto") && t.getType().equals("api")) { + } else if ("auto".equals(t.getMethod()) && "api".equals(t.getType())) { data.setStepDesc(""); data.setStepResult(""); - if (t.getTestId() != null && t.getTestId().equals("other")) { + if (t.getTestId() != null && "other".equals(t.getTestId())) { data.setRemark(t.getOtherTestName()); } else { data.setRemark("[" + t.getApiName() + "]" + "\n" + t.getRemark()); } - } else if (t.getMethod().equals("auto") && t.getType().equals("performance")) { + } else if ("auto".equals(t.getMethod()) && "performance".equals(t.getType())) { data.setStepDesc(""); data.setStepResult(""); - if (t.getTestId() != null && t.getTestId().equals("other")) { + if (t.getTestId() != null && "other".equals(t.getTestId())) { data.setRemark(t.getOtherTestName()); } else { data.setRemark(t.getPerformName()); diff --git a/backend/src/main/resources/db/migration/V78__v1.8_release.sql b/backend/src/main/resources/db/migration/V78__v1.8_release.sql index 9d4ff537cf..3b0558731e 100644 --- a/backend/src/main/resources/db/migration/V78__v1.8_release.sql +++ b/backend/src/main/resources/db/migration/V78__v1.8_release.sql @@ -161,4 +161,6 @@ UPDATE file_metadata JOIN (SELECT file_id, project_id SET file_metadata.project_id = temp.project_id; -- add execution_times testPlan alter table test_plan - add execution_times int null; \ No newline at end of file + add execution_times int null; + +alter table test_case modify method varchar(15) null comment 'Test case method type'; \ No newline at end of file