diff --git a/test-ui/src/api/performance/index.js b/test-ui/src/api/performance/index.js index 797e654..b55320f 100644 --- a/test-ui/src/api/performance/index.js +++ b/test-ui/src/api/performance/index.js @@ -68,4 +68,12 @@ export function editAndExecuteTest(data) { method: 'put', data: data }) -} \ No newline at end of file +} + +// 测试-编辑-立即执行 +export function executeTest(query) { + return request({ + url: '/test/performanceTest/executeNow?' + query, + method: 'get', + }) +} diff --git a/test-ui/src/api/performance/report.js b/test-ui/src/api/performance/report.js index 5d1beae..03fbdb5 100644 --- a/test-ui/src/api/performance/report.js +++ b/test-ui/src/api/performance/report.js @@ -1 +1,26 @@ -import request from '@/utils/request' \ No newline at end of file +import request from '@/utils/request' + +// 报告-列表查询 +export function getReportList(query) { + return request({ + url: '/test/performanceReport//list', + method: 'get', + params: query + }) +} +// 报告-列表删除 +export function deleteReport(data) { + return request({ + url: '/test/performanceReport/delete/' + data, + method: 'put', + data: data + }) +} + +// 报告-详情 +export function getReportDetail(query) { + return request({ + url: '/test/performanceReport/getInfo/' + query, + method: 'get', + }) +} diff --git a/test-ui/src/views/test/performance/performanceAdd.vue b/test-ui/src/views/test/performance/performanceAdd.vue index aedaccc..bef309d 100644 --- a/test-ui/src/views/test/performance/performanceAdd.vue +++ b/test-ui/src/views/test/performance/performanceAdd.vue @@ -148,7 +148,7 @@ export default { addForm: { performanceName: '', // 性能测试名称 performanceTestCaseVOList: [], // 场景列表 - concurrentThreads: '', // 并发用户数 + concurrentThreads: '0', // 并发用户数 errorOperType: '', // 在取样器错误后要执行的动作,1:继续;2:开始下一个线程轮询;3:停止线程;4:停止测试;5:立即停止测试 executeType: '', // 执行方式,1:按持续时间;2:按迭代次数 rampUpSeconds: '0', // 多少秒内线程建立完成,默认0 @@ -193,14 +193,36 @@ export default { time: "2025-02-22 10:00:00", }, ], + validation: false, // 校验 } }, mounted() { this.getTestCaseData() }, methods: { + // 校验 + validationForm() { + if (this.addForm.performanceName === '' || this.addForm.performanceName === null) { + this.$message({ message: '请输入测试名称', type: 'warning' }) + return + } + + if (this.addForm.errorOperType === '' || this.addForm.errorOperType === null) { + this.$message({ message: '请填写取样器错误后', type: 'warning' }) + return + } + + if (this.addForm.executeType === '' || this.addForm.executeType === null) { + this.$message({ message: '请选择执行方式', type: 'warning' }) + return + } + + this.validation = true + }, // 保存 handleWithSave() { + this.validationForm() + if (this.validation === false) { return } this.changeList.forEach(item => { var par = { testCaseId: item.id, @@ -208,7 +230,6 @@ export default { } this.addForm.performanceTestCaseVOList.push(par) }) - console.log(this.addForm) addTest(this.addForm).then(res => { if (res.code === 200) { this.$message({ message: '新增成功', type: 'success' }) @@ -220,6 +241,9 @@ export default { }, // 保存并执行 handleWithSaveAndExecute() { + this.validationForm() + if (this.validation === false) { return } + // 需要校验crontab表达式 addAndExecuteTest(this.addForm).then(res => { if (res.code === 200) { this.$message({ message: '新增成功', type: 'success' }) diff --git a/test-ui/src/views/test/performance/performanceEdit.vue b/test-ui/src/views/test/performance/performanceEdit.vue index ff5fd18..9faacc7 100644 --- a/test-ui/src/views/test/performance/performanceEdit.vue +++ b/test-ui/src/views/test/performance/performanceEdit.vue @@ -8,6 +8,7 @@
保存 保存并执行 + 立即执行 取消
@@ -143,7 +144,7 @@