新增执行用例前端及控制层逻辑
This commit is contained in:
@@ -10,6 +10,8 @@ test:
|
||||
profile: D:/test/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: true
|
||||
# Jmeter主目录路径
|
||||
jmeterHomePath: /opt/apache-jmeter
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
@@ -148,4 +150,4 @@ aj:
|
||||
# aes加密坐标开启或者禁用(true|false)
|
||||
aes-status: true
|
||||
# 滑动干扰项(0/1/2)
|
||||
interference-options: 2
|
||||
interference-options: 2
|
||||
|
||||
@@ -1,31 +1,34 @@
|
||||
package com.test.test.controller;
|
||||
|
||||
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 jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
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.TestCase;
|
||||
import com.test.test.service.ITestCaseService;
|
||||
import com.test.common.core.page.TableDataInfo;
|
||||
import com.test.common.enums.BusinessType;
|
||||
import com.test.common.utils.DateUtils;
|
||||
import com.test.test.domain.TestCase;
|
||||
import com.test.test.domain.qo.IDQO;
|
||||
import com.test.test.domain.qo.TestCaseListQO;
|
||||
import com.test.test.service.ITestCaseService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用例Controller
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/test/case")
|
||||
public class TestCaseController extends BaseController {
|
||||
|
||||
@Value("${test.jmeterHomePath:/opt/apache-jmeter}")
|
||||
private String jmeterHomePath;
|
||||
|
||||
@Resource
|
||||
private ITestCaseService testCaseService;
|
||||
|
||||
@@ -76,4 +79,14 @@ public class TestCaseController extends BaseController {
|
||||
public AjaxResult remove(@RequestBody IDQO qo) {
|
||||
return toAjax(testCaseService.deleteTestCaseById(qo.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行用例
|
||||
*/
|
||||
@Log(title = "用例", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/run")
|
||||
public AjaxResult run(@RequestBody IDQO qo) {
|
||||
log.info("执行用例 id:{}, jmeterHomePath:{}", qo.getId(), jmeterHomePath);
|
||||
return toAjax(testCaseService.executeTestCaseById(qo.getId(), jmeterHomePath));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,3 +44,12 @@ export function delCase(id) {
|
||||
data: {id}
|
||||
})
|
||||
}
|
||||
|
||||
// 执行用例
|
||||
export function runCase(id) {
|
||||
return request({
|
||||
url: '/test/case/run',
|
||||
method: 'post',
|
||||
data: {id}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
<script>
|
||||
import FolderPage from "@/components/FolderPage/index.vue";
|
||||
import {addCase, delCase, listCase} from "@/api/test/case";
|
||||
import {addCase, delCase, listCase, runCase} from "@/api/test/case";
|
||||
|
||||
export default {
|
||||
name: "Case",
|
||||
@@ -81,7 +81,11 @@ export default {
|
||||
});
|
||||
},
|
||||
handleRun(id) {
|
||||
console.log(id)
|
||||
this.$modal.confirm('是否确认执行用例?').then(function () {
|
||||
return runCase(id);
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess("执行成功");
|
||||
});
|
||||
},
|
||||
handleRowClick(row) {
|
||||
this.$tab.openPage(`用例[${row.name}]`, "/case/detail", {id: row.id});
|
||||
|
||||
Reference in New Issue
Block a user