完成前端运行逻辑10%

This commit is contained in:
haifeng414 2020-02-19 21:39:43 +08:00
parent b9f58a8910
commit 2c70faf180
4 changed files with 42 additions and 49 deletions

View File

@ -1,33 +1,6 @@
package io.metersphere.controller.request.testplan;
public class TestPlanRequest {
private String id;
private String projectId;
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
import io.metersphere.base.domain.LoadTestWithBLOBs;
public class TestPlanRequest extends LoadTestWithBLOBs {
}

View File

@ -97,6 +97,7 @@ public class LoadTestService {
loadTest.setUpdateTime(System.currentTimeMillis());
loadTest.setScenarioDefinition("todo");
loadTest.setDescription("todo");
loadTest.setLoadConfiguration(request.getLoadConfiguration());
loadTestMapper.insert(loadTest);
return loadTest;
}
@ -143,6 +144,7 @@ public class LoadTestService {
loadTest.setUpdateTime(System.currentTimeMillis());
loadTest.setScenarioDefinition("todo");
loadTest.setDescription("todo");
loadTest.setLoadConfiguration(request.getLoadConfiguration());
loadTestMapper.updateByPrimaryKeySelective(loadTest);
}
}

View File

@ -23,7 +23,7 @@
<test-plan-basic-config :test-plan="testPlan"/>
</el-tab-pane>
<el-tab-pane label="压力配置">
<test-plan-pressure-config/>
<test-plan-pressure-config :test-plan="testPlan"/>
</el-tab-pane>
<el-tab-pane label="高级配置">
<test-plan-advanced-config/>
@ -124,10 +124,14 @@
if (!this.testPlan.file.id) {
formData.append("file", this.testPlan.file);
}
if (this.testPlan.loadConfigurationObj) {
this.testPlan.loadConfiguration = JSON.stringify(this.testPlan.loadConfigurationObj);
}
// filejson
let requestJson = JSON.stringify(this.testPlan, function (key, value) {
return key === "file" ? undefined : value
});
formData.append('request', new Blob([requestJson], {
type: "application/json"
}));

View File

@ -2,11 +2,12 @@
<div class="pressure-config-container">
<el-row type="flex">
<div class="small-input">
<span>线程</span>
<span>并发用户</span>
<el-input
type="number"
placeholder="请输入线程数"
v-model="threadNumber"
@click="convertProperty"
show-word-limit
>
</el-input>
@ -17,19 +18,31 @@
type="number"
placeholder="请输入时长"
v-model="duration"
@click="convertProperty"
show-word-limit
>
</el-input>
</div>
<div class="small-input">
<span>Ramp-Up时间</span>
<span></span>
<el-input
type="number"
placeholder="请输入时间"
placeholder=""
v-model="rampUpTime"
@click="convertProperty"
show-word-limit
>
</el-input>
<span>分钟内</span>
<el-input
type="number"
placeholder=""
v-model="step"
@click="convertProperty"
show-word-limit
>
</el-input>
<span>次增加并发用户</span>
</div>
</el-row>
</div>
@ -38,28 +51,29 @@
<script>
export default {
name: "TestPlanPressureConfig",
props: ["testPlan"],
data() {
return {
threadNumber: 10,
duration: 10,
rampUpTime: 5,
chartData: {
columns: ['压测时长(分钟)', '并发量'],
rows: [
{'压测时长(分钟)': '1月1日', '并发量': 123},
{'压测时长(分钟)': '1月2日', '并发量': 1223},
{'压测时长(分钟)': '1月3日', '并发量': 2123},
{'压测时长(分钟)': '1月4日', '并发量': 4123},
{'压测时长(分钟)': '1月5日', '并发量': 3123},
{'压测时长(分钟)': '1月6日', '并发量': 7123}
]
},
threadNumber: 2,
duration: 3,
rampUpTime: 12,
step: 2,
}
},
beforeCreate() {
created() {
this.testPlan.loadConfigurationObj = [];
this.convertProperty();
},
methods: {
convertProperty() {
/// todo4jmeter ConcurrencyThreadGroup plugin
this.testPlan.loadConfigurationObj = [
{key: "TargetLevel", value: this.threadNumber},
{key: "RampUp", value: this.rampUpTime},
{key: "Steps", value: this.step},
{key: "Hold", value: this.duration}
];
}
}
}
</script>