保存测试到数据库
This commit is contained in:
parent
25cefe71df
commit
de2ad1337b
|
@ -38,7 +38,7 @@ public class LoadTestController {
|
|||
|
||||
@PostMapping("/save")
|
||||
public void save(@RequestBody SaveTestPlanRequest request) {
|
||||
System.out.println(String.format("save test plan: %s", request.getName()));
|
||||
loadTestService.save(request);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
|
|
|
@ -3,7 +3,7 @@ package io.metersphere.controller.request.testplan;
|
|||
public class TestPlanRequest {
|
||||
private String id;
|
||||
private String fileId;
|
||||
private String project;
|
||||
private String projectId;
|
||||
private String name;
|
||||
|
||||
|
||||
|
@ -23,12 +23,12 @@ public class TestPlanRequest {
|
|||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
public String getProject() {
|
||||
return project;
|
||||
public String getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProject(String project) {
|
||||
this.project = project;
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.base.mapper.ProjectMapper;
|
|||
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
|
||||
import io.metersphere.controller.request.testplan.DeleteTestPlanRequest;
|
||||
import io.metersphere.controller.request.testplan.QueryTestPlanRequest;
|
||||
import io.metersphere.controller.request.testplan.SaveTestPlanRequest;
|
||||
import io.metersphere.dto.LoadTestDTO;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -61,4 +62,16 @@ public class LoadTestService {
|
|||
|
||||
loadTestMapper.deleteByExample(loadTestExample);
|
||||
}
|
||||
|
||||
public void save(SaveTestPlanRequest request) {
|
||||
final LoadTestWithBLOBs loadTest = new LoadTestWithBLOBs();
|
||||
loadTest.setId(UUID.randomUUID().toString());
|
||||
loadTest.setName(request.getName());
|
||||
loadTest.setProjectId(request.getProjectId());
|
||||
loadTest.setCreateTime(System.currentTimeMillis());
|
||||
loadTest.setUpdateTime(System.currentTimeMillis());
|
||||
loadTest.setScenarioDefinition("todo");
|
||||
loadTest.setDescription("todo");
|
||||
loadTestMapper.insert(loadTest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
"vue-i18n": "^8.15.3",
|
||||
"vue-router": "^3.1.3",
|
||||
"vuex": "^3.1.2",
|
||||
"js-cookie": "^2.2.0"
|
||||
"js-cookie": "^2.2.0",
|
||||
"v-charts": "^1.19.0",
|
||||
"echarts": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^4.1.0",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="testplan-container">
|
||||
<div class="edit-testplan-container">
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<el-input placeholder="请输入名称" v-model="testPlan.name" class="input-with-select">
|
||||
|
@ -8,7 +8,7 @@
|
|||
v-for="item in projects"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.name">
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
|
@ -125,7 +125,7 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!this.testPlan.project) {
|
||||
if (!this.testPlan.projectId) {
|
||||
this.$message({
|
||||
message: '项目不能为空!',
|
||||
type: 'error'
|
||||
|
@ -151,16 +151,16 @@
|
|||
</script>
|
||||
|
||||
<style>
|
||||
.testplan-container .el-tabs__nav {
|
||||
.edit-testplan-container .el-tabs__nav {
|
||||
float: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.testplan-container .el-select .el-input {
|
||||
.edit-testplan-container .el-select .el-input {
|
||||
width: 130px;
|
||||
}
|
||||
|
||||
.testplan-container .input-with-select .el-input-group__prepend {
|
||||
.edit-testplan-container .input-with-select .el-input-group__prepend {
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,63 +1,38 @@
|
|||
<template>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<div>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div>
|
||||
并发用户:
|
||||
<el-input
|
||||
type="number"
|
||||
placeholder="请输入线程数"
|
||||
v-model="threadNumber"
|
||||
show-word-limit
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div>
|
||||
压测时长:
|
||||
<el-input
|
||||
type="number"
|
||||
placeholder="请输入时长(min)"
|
||||
v-model="duration"
|
||||
show-word-limit
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div>
|
||||
在
|
||||
<div style="width: 80px;">
|
||||
<el-input
|
||||
type="number"
|
||||
v-model="rampUpTime"
|
||||
show-word-limit
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
分钟内,分
|
||||
<div style="width: 80px;">
|
||||
<el-input
|
||||
type="number"
|
||||
v-model="rampUpCount"
|
||||
show-word-limit
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
次增加并发用户
|
||||
</div>
|
||||
</el-row>
|
||||
<div class="pressure-config-container">
|
||||
<el-row type="flex">
|
||||
<div class="small-input">
|
||||
<span>线程数:</span>
|
||||
<el-input
|
||||
type="number"
|
||||
placeholder="请输入线程数"
|
||||
v-model="threadNumber"
|
||||
show-word-limit
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
压力预估图
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="small-input">
|
||||
<span>压测时长(分钟):</span>
|
||||
<el-input
|
||||
type="number"
|
||||
placeholder="请输入时长"
|
||||
v-model="duration"
|
||||
show-word-limit
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="small-input">
|
||||
<span>Ramp-Up时间(秒)</span>
|
||||
<el-input
|
||||
type="number"
|
||||
placeholder="请输入时间"
|
||||
v-model="rampUpTime"
|
||||
show-word-limit
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -68,8 +43,21 @@
|
|||
threadNumber: 10,
|
||||
duration: 10,
|
||||
rampUpTime: 5,
|
||||
rampUpCount: 2,
|
||||
chartData: {
|
||||
columns: ['压测时长(分钟)', '并发量'],
|
||||
rows: [
|
||||
{'压测时长(分钟)': '1月1日', '并发量': 123},
|
||||
{'压测时长(分钟)': '1月2日', '并发量': 1223},
|
||||
{'压测时长(分钟)': '1月3日', '并发量': 2123},
|
||||
{'压测时长(分钟)': '1月4日', '并发量': 4123},
|
||||
{'压测时长(分钟)': '1月5日', '并发量': 3123},
|
||||
{'压测时长(分钟)': '1月6日', '并发量': 7123}
|
||||
]
|
||||
},
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
testChange() {
|
||||
|
@ -83,3 +71,9 @@
|
|||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.pressure-config-container .small-input {
|
||||
width: 150px;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue