解决测试计划性能测试相关bug
This commit is contained in:
@@ -283,6 +283,9 @@ public class JMeterGroupUtil {
|
|||||||
threadGroup.setDelay(0);
|
threadGroup.setDelay(0);
|
||||||
if (executeType == 1) {
|
if (executeType == 1) {
|
||||||
threadGroup.setDuration(pressureSecond);
|
threadGroup.setDuration(pressureSecond);
|
||||||
|
threadGroup.setProperty(new TestElementProperty(ThreadGroup.MAIN_CONTROLLER, createLoopController(-1)));
|
||||||
|
threadGroup.setProperty(new StringProperty(ThreadGroup.SCHEDULER, "true"));
|
||||||
|
threadGroup.setProperty(new StringProperty(ThreadGroup.IS_SAME_USER_ON_NEXT_ITERATION, "true"));
|
||||||
} else {
|
} else {
|
||||||
threadGroup.setProperty(new TestElementProperty(ThreadGroup.MAIN_CONTROLLER, createLoopController(loops)));
|
threadGroup.setProperty(new TestElementProperty(ThreadGroup.MAIN_CONTROLLER, createLoopController(loops)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package com.test.test.controller;
|
package com.test.test.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.test.common.annotation.Log;
|
||||||
|
import com.test.common.core.controller.BaseController;
|
||||||
|
import com.test.common.core.domain.AjaxResult;
|
||||||
|
import com.test.common.core.page.TableDataInfo;
|
||||||
|
import com.test.common.enums.BusinessType;
|
||||||
import com.test.common.utils.StringUtils;
|
import com.test.common.utils.StringUtils;
|
||||||
|
import com.test.common.utils.poi.ExcelUtil;
|
||||||
import com.test.test.domain.PerformanceTest;
|
import com.test.test.domain.PerformanceTest;
|
||||||
import com.test.test.domain.TestCase;
|
import com.test.test.domain.TestCase;
|
||||||
import com.test.test.domain.qo.PerformanceTestQO;
|
import com.test.test.domain.qo.PerformanceTestQO;
|
||||||
@@ -13,16 +17,12 @@ import com.test.test.service.ITestCaseService;
|
|||||||
import com.test.test.task.DynamicTaskManager;
|
import com.test.test.task.DynamicTaskManager;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import com.test.common.annotation.Log;
|
|
||||||
import com.test.common.core.controller.BaseController;
|
import java.util.List;
|
||||||
import com.test.common.core.domain.AjaxResult;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import com.test.common.enums.BusinessType;
|
|
||||||
import com.test.common.utils.poi.ExcelUtil;
|
|
||||||
import com.test.common.core.page.TableDataInfo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 性能测试Controller
|
* 性能测试Controller
|
||||||
@@ -134,8 +134,12 @@ public class PerformanceTestController extends BaseController {
|
|||||||
}
|
}
|
||||||
// 执行性能测试
|
// 执行性能测试
|
||||||
try {
|
try {
|
||||||
Long l1 = performanceTestCaseReportService.executePerformanceTestAndReport(l, jmeterHomePath, 2);
|
CompletableFuture.runAsync(() -> {
|
||||||
return success(l1);
|
performanceTestCaseReportService.executePerformanceTestAndReport(l, jmeterHomePath, 2);
|
||||||
|
});
|
||||||
|
return toAjax(true);
|
||||||
|
// Long l1 = performanceTestCaseReportService.executePerformanceTestAndReport(l, jmeterHomePath, 2);
|
||||||
|
// return success(l1);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("执行失败!", e);
|
log.error("执行失败!", e);
|
||||||
return error("执行失败!");
|
return error("执行失败!");
|
||||||
@@ -195,8 +199,12 @@ public class PerformanceTestController extends BaseController {
|
|||||||
dynamicTaskManager.updateTask(entity);
|
dynamicTaskManager.updateTask(entity);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Long l1 = performanceTestCaseReportService.executePerformanceTestAndReport(l, jmeterHomePath, 2);
|
CompletableFuture.runAsync(() -> {
|
||||||
return success(l1);
|
performanceTestCaseReportService.executePerformanceTestAndReport(l, jmeterHomePath, 2);
|
||||||
|
});
|
||||||
|
return toAjax(true);
|
||||||
|
// Long l1 = performanceTestCaseReportService.executePerformanceTestAndReport(l, jmeterHomePath, 2);
|
||||||
|
// return success(l1);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("执行失败!", e);
|
log.error("执行失败!", e);
|
||||||
return error("执行失败!");
|
return error("执行失败!");
|
||||||
@@ -224,7 +232,11 @@ public class PerformanceTestController extends BaseController {
|
|||||||
// @PreAuthorize("@ss.hasPermi('system:test:remove')")
|
// @PreAuthorize("@ss.hasPermi('system:test:remove')")
|
||||||
@GetMapping("/executeNow")
|
@GetMapping("/executeNow")
|
||||||
public AjaxResult executeNow(@RequestParam Long id) {
|
public AjaxResult executeNow(@RequestParam Long id) {
|
||||||
Long l1 = performanceTestCaseReportService.executePerformanceTestAndReport(id, jmeterHomePath, 2);
|
CompletableFuture.runAsync(() -> {
|
||||||
return success(l1);
|
performanceTestCaseReportService.executePerformanceTestAndReport(id, jmeterHomePath, 2);
|
||||||
|
});
|
||||||
|
return toAjax(true);
|
||||||
|
// Long l1 = performanceTestCaseReportService.executePerformanceTestAndReport(id, jmeterHomePath, 2);
|
||||||
|
// return success(l1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,6 @@ export function editAndExecuteTest(data) {
|
|||||||
export function executeTest(query) {
|
export function executeTest(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/test/performanceTest/executeNow?id=' + query,
|
url: '/test/performanceTest/executeNow?id=' + query,
|
||||||
method: 'get',
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<div class="name-wrap">测试名称</div>
|
<div class="name-wrap">测试名称</div>
|
||||||
<el-input v-model="addForm.performanceName" placeholder="请输入名称" maxlength="255" show-word-limit></el-input>
|
<el-input v-model="addForm.performanceName" placeholder="请输入名称" maxlength="255" show-word-limit></el-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="save">
|
<div class="save" v-loading="loading">
|
||||||
<el-button type="primary" plain @click="handleWithSave">保存</el-button>
|
<el-button type="primary" plain @click="handleWithSave">保存</el-button>
|
||||||
<el-button type="primary" plain @click="handleWithSaveAndExecute">保存并执行</el-button>
|
<el-button type="primary" plain @click="handleWithSaveAndExecute">保存并执行</el-button>
|
||||||
<el-button type="primary" plain @click="handleWithExecute">立即执行</el-button>
|
<el-button type="primary" plain @click="handleWithExecute">立即执行</el-button>
|
||||||
@@ -166,6 +166,7 @@ export default {
|
|||||||
crontabStatus: '0', // 定时任务状态:0关闭,1开启,默认0
|
crontabStatus: '0', // 定时任务状态:0关闭,1开启,默认0
|
||||||
loopCount: '0', // 迭代次数,默认0
|
loopCount: '0', // 迭代次数,默认0
|
||||||
},
|
},
|
||||||
|
loading: false,
|
||||||
activeName: 'first',
|
activeName: 'first',
|
||||||
sceneList: [], // 场景列表
|
sceneList: [], // 场景列表
|
||||||
dialogVisible: false, // 场景列表
|
dialogVisible: false, // 场景列表
|
||||||
@@ -247,6 +248,7 @@ export default {
|
|||||||
this.$message({ message: '请输入Crontab表达式', type: 'warning' })
|
this.$message({ message: '请输入Crontab表达式', type: 'warning' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.loading = true;
|
||||||
editAndExecuteTest(this.addForm).then(res => {
|
editAndExecuteTest(this.addForm).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.$message({ message: '编辑成功', type: 'success' })
|
this.$message({ message: '编辑成功', type: 'success' })
|
||||||
@@ -254,17 +256,22 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.$message({ message: '编辑失败', type: 'error' })
|
this.$message({ message: '编辑失败', type: 'error' })
|
||||||
}
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 立即执行
|
// 立即执行
|
||||||
handleWithExecute() {
|
handleWithExecute() {
|
||||||
|
this.loading = true;
|
||||||
executeTest(this.$route.query.id).then(res => {
|
executeTest(this.$route.query.id).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.$message({ message: '执行成功', type: 'success' })
|
this.$message({ message: '执行成功', type: 'success' })
|
||||||
this.$tab.closeOpenPage({ path: "/performance/performance" });
|
// this.$tab.closeOpenPage({ path: "/performance/performance" });
|
||||||
} else {
|
} else {
|
||||||
this.$message({ message: '执行失败', type: 'error' })
|
this.$message({ message: '执行失败', type: 'error' })
|
||||||
}
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 取消
|
// 取消
|
||||||
|
|||||||
@@ -145,9 +145,9 @@ export default {
|
|||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
relateCaseVue() {
|
relateCaseVue() {
|
||||||
this.open = true;
|
// this.open = true;
|
||||||
this.reset();
|
// this.reset();
|
||||||
this.$refs.relateCase.getList()
|
// this.$refs.relateCase.getList()
|
||||||
},
|
},
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
getList() {
|
getList() {
|
||||||
@@ -176,7 +176,9 @@ export default {
|
|||||||
return runTestPlanCase(queryParams);
|
return runTestPlanCase(queryParams);
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
this.$modal.msgSuccess("提交执行成功");
|
this.$modal.msgSuccess("提交执行成功");
|
||||||
this.open = true;
|
// this.open = true;
|
||||||
|
this.loading = false;
|
||||||
|
}).finally(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user