完成前端运行逻辑10%
This commit is contained in:
parent
b9f58a8910
commit
2c70faf180
|
@ -1,33 +1,6 @@
|
||||||
package io.metersphere.controller.request.testplan;
|
package io.metersphere.controller.request.testplan;
|
||||||
|
|
||||||
public class TestPlanRequest {
|
import io.metersphere.base.domain.LoadTestWithBLOBs;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public class TestPlanRequest extends LoadTestWithBLOBs {
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@ public class LoadTestService {
|
||||||
loadTest.setUpdateTime(System.currentTimeMillis());
|
loadTest.setUpdateTime(System.currentTimeMillis());
|
||||||
loadTest.setScenarioDefinition("todo");
|
loadTest.setScenarioDefinition("todo");
|
||||||
loadTest.setDescription("todo");
|
loadTest.setDescription("todo");
|
||||||
|
loadTest.setLoadConfiguration(request.getLoadConfiguration());
|
||||||
loadTestMapper.insert(loadTest);
|
loadTestMapper.insert(loadTest);
|
||||||
return loadTest;
|
return loadTest;
|
||||||
}
|
}
|
||||||
|
@ -143,6 +144,7 @@ public class LoadTestService {
|
||||||
loadTest.setUpdateTime(System.currentTimeMillis());
|
loadTest.setUpdateTime(System.currentTimeMillis());
|
||||||
loadTest.setScenarioDefinition("todo");
|
loadTest.setScenarioDefinition("todo");
|
||||||
loadTest.setDescription("todo");
|
loadTest.setDescription("todo");
|
||||||
|
loadTest.setLoadConfiguration(request.getLoadConfiguration());
|
||||||
loadTestMapper.updateByPrimaryKeySelective(loadTest);
|
loadTestMapper.updateByPrimaryKeySelective(loadTest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<test-plan-basic-config :test-plan="testPlan"/>
|
<test-plan-basic-config :test-plan="testPlan"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="压力配置">
|
<el-tab-pane label="压力配置">
|
||||||
<test-plan-pressure-config/>
|
<test-plan-pressure-config :test-plan="testPlan"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="高级配置">
|
<el-tab-pane label="高级配置">
|
||||||
<test-plan-advanced-config/>
|
<test-plan-advanced-config/>
|
||||||
|
@ -124,10 +124,14 @@
|
||||||
if (!this.testPlan.file.id) {
|
if (!this.testPlan.file.id) {
|
||||||
formData.append("file", this.testPlan.file);
|
formData.append("file", this.testPlan.file);
|
||||||
}
|
}
|
||||||
|
if (this.testPlan.loadConfigurationObj) {
|
||||||
|
this.testPlan.loadConfiguration = JSON.stringify(this.testPlan.loadConfigurationObj);
|
||||||
|
}
|
||||||
// file属性不需要json化
|
// file属性不需要json化
|
||||||
let requestJson = JSON.stringify(this.testPlan, function (key, value) {
|
let requestJson = JSON.stringify(this.testPlan, function (key, value) {
|
||||||
return key === "file" ? undefined : value
|
return key === "file" ? undefined : value
|
||||||
});
|
});
|
||||||
|
|
||||||
formData.append('request', new Blob([requestJson], {
|
formData.append('request', new Blob([requestJson], {
|
||||||
type: "application/json"
|
type: "application/json"
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
<div class="pressure-config-container">
|
<div class="pressure-config-container">
|
||||||
<el-row type="flex">
|
<el-row type="flex">
|
||||||
<div class="small-input">
|
<div class="small-input">
|
||||||
<span>线程数:</span>
|
<span>并发用户数:</span>
|
||||||
<el-input
|
<el-input
|
||||||
type="number"
|
type="number"
|
||||||
placeholder="请输入线程数"
|
placeholder="请输入线程数"
|
||||||
v-model="threadNumber"
|
v-model="threadNumber"
|
||||||
|
@click="convertProperty"
|
||||||
show-word-limit
|
show-word-limit
|
||||||
>
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
@ -17,19 +18,31 @@
|
||||||
type="number"
|
type="number"
|
||||||
placeholder="请输入时长"
|
placeholder="请输入时长"
|
||||||
v-model="duration"
|
v-model="duration"
|
||||||
|
@click="convertProperty"
|
||||||
show-word-limit
|
show-word-limit
|
||||||
>
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="small-input">
|
<div class="small-input">
|
||||||
<span>Ramp-Up时间(秒)</span>
|
<span>在</span>
|
||||||
<el-input
|
<el-input
|
||||||
type="number"
|
type="number"
|
||||||
placeholder="请输入时间"
|
placeholder=""
|
||||||
v-model="rampUpTime"
|
v-model="rampUpTime"
|
||||||
|
@click="convertProperty"
|
||||||
show-word-limit
|
show-word-limit
|
||||||
>
|
>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
<span>分钟内,分</span>
|
||||||
|
<el-input
|
||||||
|
type="number"
|
||||||
|
placeholder=""
|
||||||
|
v-model="step"
|
||||||
|
@click="convertProperty"
|
||||||
|
show-word-limit
|
||||||
|
>
|
||||||
|
</el-input>
|
||||||
|
<span>次增加并发用户</span>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
@ -38,28 +51,29 @@
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "TestPlanPressureConfig",
|
name: "TestPlanPressureConfig",
|
||||||
|
props: ["testPlan"],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
threadNumber: 10,
|
threadNumber: 2,
|
||||||
duration: 10,
|
duration: 3,
|
||||||
rampUpTime: 5,
|
rampUpTime: 12,
|
||||||
chartData: {
|
step: 2,
|
||||||
columns: ['压测时长(分钟)', '并发量'],
|
|
||||||
rows: [
|
|
||||||
{'压测时长(分钟)': '1月1日', '并发量': 123},
|
|
||||||
{'压测时长(分钟)': '1月2日', '并发量': 1223},
|
|
||||||
{'压测时长(分钟)': '1月3日', '并发量': 2123},
|
|
||||||
{'压测时长(分钟)': '1月4日', '并发量': 4123},
|
|
||||||
{'压测时长(分钟)': '1月5日', '并发量': 3123},
|
|
||||||
{'压测时长(分钟)': '1月6日', '并发量': 7123}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeCreate() {
|
created() {
|
||||||
|
this.testPlan.loadConfigurationObj = [];
|
||||||
|
this.convertProperty();
|
||||||
},
|
},
|
||||||
methods: {
|
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>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue