完成前端运行逻辑10%
This commit is contained in:
parent
b9f58a8910
commit
2c70faf180
|
@ -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 {
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
// file属性不需要json化
|
||||
let requestJson = JSON.stringify(this.testPlan, function (key, value) {
|
||||
return key === "file" ? undefined : value
|
||||
});
|
||||
|
||||
formData.append('request', new Blob([requestJson], {
|
||||
type: "application/json"
|
||||
}));
|
||||
|
|
|
@ -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() {
|
||||
/// todo:下面4个属性是jmeter 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>
|
||||
|
|
Loading…
Reference in New Issue