diff --git a/test-test/src/main/java/com/test/test/controller/TestCaseController.java b/test-test/src/main/java/com/test/test/controller/TestCaseController.java index f668c37..45d079e 100644 --- a/test-test/src/main/java/com/test/test/controller/TestCaseController.java +++ b/test-test/src/main/java/com/test/test/controller/TestCaseController.java @@ -4,7 +4,7 @@ import java.util.List; import com.test.common.utils.DateUtils; import com.test.test.domain.qo.IDQO; -import com.test.test.domain.qo.TestCaseListQO; +import com.test.test.domain.qo.GroupIdQO; import jakarta.annotation.Resource; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; @@ -33,7 +33,7 @@ public class TestCaseController extends BaseController { * 查询用例列表 */ @GetMapping("/list") - public TableDataInfo list(@Validated TestCaseListQO qo) { + public TableDataInfo list(@Validated GroupIdQO qo) { startPage(); List list = testCaseService.selectTestCaseList(qo); return getDataTable(list); diff --git a/test-test/src/main/java/com/test/test/controller/TestTaskController.java b/test-test/src/main/java/com/test/test/controller/TestTaskController.java new file mode 100644 index 0000000..7678acb --- /dev/null +++ b/test-test/src/main/java/com/test/test/controller/TestTaskController.java @@ -0,0 +1,83 @@ +package com.test.test.controller; + +import java.util.List; + +import com.test.common.utils.DateUtils; +import com.test.test.domain.qo.GroupIdQO; +import com.test.test.domain.qo.IDQO; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.test.common.annotation.Log; +import com.test.common.core.controller.BaseController; +import com.test.common.core.domain.AjaxResult; +import com.test.common.enums.BusinessType; +import com.test.test.domain.TestTask; +import com.test.test.service.ITestTaskService; +import com.test.common.utils.poi.ExcelUtil; +import com.test.common.core.page.TableDataInfo; + +/** + * 自动化测试Controller + */ +@RestController +@RequestMapping("/test/task") +public class TestTaskController extends BaseController { + @Resource + private ITestTaskService testTaskService; + + /** + * 查询自动化测试列表 + */ + @GetMapping("/list") + public TableDataInfo list(GroupIdQO qo) { + startPage(); + List list = testTaskService.selectTestTaskList(qo); + return getDataTable(list); + } + + /** + * 获取自动化测试详细信息 + */ + @PostMapping(value = "/detail") + public AjaxResult getInfo(@RequestBody IDQO qo) { + return success(testTaskService.selectTestTaskById(qo.getId())); + } + + /** + * 新增自动化测试 + */ + @Log(title = "自动化测试", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody TestTask testTask) { + testTask.setCreateBy(getLoginUser().getUsername()); + testTask.setCreateTime(DateUtils.getNowDate()); + testTask.setStatus(0); + return toAjax(testTaskService.insertTestTask(testTask)); + } + + /** + * 修改自动化测试 + */ + @Log(title = "自动化测试", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + public AjaxResult edit(@RequestBody TestTask testTask) { + return toAjax(testTaskService.updateTestTask(testTask)); + } + + /** + * 删除自动化测试 + */ + @Log(title = "自动化测试", businessType = BusinessType.DELETE) + @PostMapping("/del") + public AjaxResult remove(@RequestBody IDQO qo) { + return toAjax(testTaskService.deleteTestTaskById(qo.getId())); + } +} diff --git a/test-test/src/main/java/com/test/test/domain/qo/TestCaseListQO.java b/test-test/src/main/java/com/test/test/domain/qo/GroupIdQO.java similarity index 86% rename from test-test/src/main/java/com/test/test/domain/qo/TestCaseListQO.java rename to test-test/src/main/java/com/test/test/domain/qo/GroupIdQO.java index 56ed405..b690898 100644 --- a/test-test/src/main/java/com/test/test/domain/qo/TestCaseListQO.java +++ b/test-test/src/main/java/com/test/test/domain/qo/GroupIdQO.java @@ -4,7 +4,7 @@ import jakarta.validation.constraints.NotNull; import lombok.Data; @Data -public class TestCaseListQO { +public class GroupIdQO { @NotNull(message = "父节点id不能为空") private Long groupId; } diff --git a/test-test/src/main/java/com/test/test/mapper/TestCaseMapper.java b/test-test/src/main/java/com/test/test/mapper/TestCaseMapper.java index 9b224eb..58cbbf7 100644 --- a/test-test/src/main/java/com/test/test/mapper/TestCaseMapper.java +++ b/test-test/src/main/java/com/test/test/mapper/TestCaseMapper.java @@ -1,7 +1,7 @@ package com.test.test.mapper; import com.test.test.domain.TestCase; -import com.test.test.domain.qo.TestCaseListQO; +import com.test.test.domain.qo.GroupIdQO; import java.util.List; @@ -18,7 +18,7 @@ public interface TestCaseMapper /** * 查询用例列表 */ - List selectTestCaseList(TestCaseListQO qo); + List selectTestCaseList(GroupIdQO qo); /** * 新增用例 diff --git a/test-test/src/main/java/com/test/test/service/ITestCaseService.java b/test-test/src/main/java/com/test/test/service/ITestCaseService.java index c79ebcc..a33bb51 100644 --- a/test-test/src/main/java/com/test/test/service/ITestCaseService.java +++ b/test-test/src/main/java/com/test/test/service/ITestCaseService.java @@ -1,7 +1,7 @@ package com.test.test.service; import com.test.test.domain.TestCase; -import com.test.test.domain.qo.TestCaseListQO; +import com.test.test.domain.qo.GroupIdQO; import java.util.List; @@ -27,7 +27,7 @@ public interface ITestCaseService * @param qo 用例 * @return 用例集合 */ - public List selectTestCaseList(TestCaseListQO qo); + public List selectTestCaseList(GroupIdQO qo); /** * 新增用例 diff --git a/test-test/src/main/java/com/test/test/service/impl/TestCaseServiceImpl.java b/test-test/src/main/java/com/test/test/service/impl/TestCaseServiceImpl.java index 842f45a..3d22868 100644 --- a/test-test/src/main/java/com/test/test/service/impl/TestCaseServiceImpl.java +++ b/test-test/src/main/java/com/test/test/service/impl/TestCaseServiceImpl.java @@ -68,7 +68,7 @@ public class TestCaseServiceImpl implements ITestCaseService * @return 用例 */ @Override - public List selectTestCaseList(TestCaseListQO qo) { + public List selectTestCaseList(GroupIdQO qo) { return testCaseMapper.selectTestCaseList(qo); } diff --git a/test-test/src/main/resources/mapper/test/TestCaseMapper.xml b/test-test/src/main/resources/mapper/test/TestCaseMapper.xml index 846430e..9eed395 100644 --- a/test-test/src/main/resources/mapper/test/TestCaseMapper.xml +++ b/test-test/src/main/resources/mapper/test/TestCaseMapper.xml @@ -33,7 +33,7 @@ from test_case - group_id = #{groupId} diff --git a/test-ui/src/assets/images/header.png b/test-ui/src/assets/images/header.png new file mode 100644 index 0000000..57030eb Binary files /dev/null and b/test-ui/src/assets/images/header.png differ diff --git a/test-ui/src/views/test/case/index.vue b/test-ui/src/views/test/case/index.vue index 471c478..fec42c2 100644 --- a/test-ui/src/views/test/case/index.vue +++ b/test-ui/src/views/test/case/index.vue @@ -62,7 +62,7 @@ export default { }); }, handleAdd() { - this.$prompt('请输入名称', '提示', { + this.$prompt('请输入名称', '新增', { confirmButtonText: '确定', cancelButtonText: '取消', inputPattern: /^(?!\s*$).+/, @@ -80,7 +80,7 @@ export default { }); }, handleRowClick(row) { - this.$tab.openPage("用例 - " + row.name, "/case/detail", {id: row.id}); + this.$tab.openPage(`用例[${row.name}]`, "/case/detail", {id: row.id}); }, handleDelete(id) { this.$modal.confirm('是否确认删除用例?').then(function () { diff --git a/test-ui/src/views/test/task/edit/clickOutside.js b/test-ui/src/views/test/task/edit/clickOutside.js new file mode 100644 index 0000000..f4019d3 --- /dev/null +++ b/test-ui/src/views/test/task/edit/clickOutside.js @@ -0,0 +1,18 @@ +// clickOutside.js +export default { + bind(el, binding, vnode) { + el.clickOutsideEvent = function (event) { + // 检查点击事件的目标元素是否是绑定指令的元素或其子元素 + if (!(el === event.target || el.contains(event.target))) { + // 如果不是,则调用传递给指令的方法 + vnode.context[binding.expression](event); + } + }; + // 添加事件监听器 + document.body.addEventListener("click", el.clickOutsideEvent); + }, + unbind(el) { + // 移除事件监听器 + document.body.removeEventListener("click", el.clickOutsideEvent); + }, +}; diff --git a/test-ui/src/views/test/task/edit/executionRecord.vue b/test-ui/src/views/test/task/edit/executionRecord.vue new file mode 100644 index 0000000..649104e --- /dev/null +++ b/test-ui/src/views/test/task/edit/executionRecord.vue @@ -0,0 +1,256 @@ + + + + diff --git a/test-ui/src/views/test/task/edit/executiveReport.vue b/test-ui/src/views/test/task/edit/executiveReport.vue new file mode 100644 index 0000000..e69de29 diff --git a/test-ui/src/views/test/task/edit/index.vue b/test-ui/src/views/test/task/edit/index.vue new file mode 100644 index 0000000..403f376 --- /dev/null +++ b/test-ui/src/views/test/task/edit/index.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/test-ui/src/views/test/task/edit/lineChart.vue b/test-ui/src/views/test/task/edit/lineChart.vue new file mode 100644 index 0000000..0c26bb6 --- /dev/null +++ b/test-ui/src/views/test/task/edit/lineChart.vue @@ -0,0 +1,159 @@ + + + diff --git a/test-ui/src/views/test/task/edit/lineChartCover.vue b/test-ui/src/views/test/task/edit/lineChartCover.vue new file mode 100644 index 0000000..79db731 --- /dev/null +++ b/test-ui/src/views/test/task/edit/lineChartCover.vue @@ -0,0 +1,168 @@ + + + diff --git a/test-ui/src/views/test/task/edit/operationRecords.vue b/test-ui/src/views/test/task/edit/operationRecords.vue new file mode 100644 index 0000000..580607c --- /dev/null +++ b/test-ui/src/views/test/task/edit/operationRecords.vue @@ -0,0 +1,92 @@ + + + + + diff --git a/test-ui/src/views/test/task/edit/report/components/pieChart.vue b/test-ui/src/views/test/task/edit/report/components/pieChart.vue new file mode 100644 index 0000000..e545247 --- /dev/null +++ b/test-ui/src/views/test/task/edit/report/components/pieChart.vue @@ -0,0 +1,111 @@ + + + diff --git a/test-ui/src/views/test/task/edit/report/index.vue b/test-ui/src/views/test/task/edit/report/index.vue new file mode 100644 index 0000000..f1d06e9 --- /dev/null +++ b/test-ui/src/views/test/task/edit/report/index.vue @@ -0,0 +1,292 @@ + + + + + diff --git a/test-ui/src/views/test/task/edit/taskDetails.vue b/test-ui/src/views/test/task/edit/taskDetails.vue new file mode 100644 index 0000000..9d1d425 --- /dev/null +++ b/test-ui/src/views/test/task/edit/taskDetails.vue @@ -0,0 +1,735 @@ + + + + diff --git a/test-ui/src/views/test/task/edit/test1.vue b/test-ui/src/views/test/task/edit/test1.vue new file mode 100644 index 0000000..7d5e2f2 --- /dev/null +++ b/test-ui/src/views/test/task/edit/test1.vue @@ -0,0 +1,47 @@ + + + diff --git a/test-ui/src/views/test/task/edit/test2.vue b/test-ui/src/views/test/task/edit/test2.vue new file mode 100644 index 0000000..6d2fcd6 --- /dev/null +++ b/test-ui/src/views/test/task/edit/test2.vue @@ -0,0 +1,217 @@ + + + + + diff --git a/test-ui/src/views/test/task/index.vue b/test-ui/src/views/test/task/index.vue index 98deb69..f5a6829 100644 --- a/test-ui/src/views/test/task/index.vue +++ b/test-ui/src/views/test/task/index.vue @@ -1,24 +1,100 @@