run button

This commit is contained in:
q4speed 2020-04-23 17:08:48 +08:00
parent 39fc93946b
commit 1294739df6
5 changed files with 44 additions and 16 deletions

View File

@ -60,9 +60,9 @@ public class APITestController {
public void delete(@RequestBody DeleteAPITestRequest request) {
apiTestService.delete(request);
}
//
// @PostMapping("/run")
// public void run(@RequestBody RunTestPlanRequest request) {
// apiTestService.run(request);
// }
@PostMapping("/run")
public void run(@RequestBody SaveAPITestRequest request) {
apiTestService.run(request);
}
}

View File

@ -66,6 +66,10 @@ public class ApiTestService {
apiTestMapper.deleteByPrimaryKey(request.getId());
}
public void run(SaveAPITestRequest request) {
save(request);
}
private ApiTestWithBLOBs updateTest(SaveAPITestRequest request) {
final ApiTestWithBLOBs test = new ApiTestWithBLOBs();
test.setId(request.getId());

View File

@ -11,7 +11,15 @@
<el-option v-for="project in projects" :key="project.id" :label="project.name" :value="project.id"/>
</el-select>
</el-input>
<el-button type="primary" plain :disabled="isDisabled" @click="saveTest">{{$t('commons.save')}}</el-button>
<el-button type="primary" plain :disabled="isDisabled" @click="saveTest">
{{$t('commons.save')}}
</el-button>
<el-button type="primary" plain :disabled="isDisabled" @click="runTest">
{{$t('load_test.save_and_run')}}
</el-button>
<el-button type="warning" plain @click="clear">{{$t('commons.cancel')}}</el-button>
</el-row>
</el-header>
<ms-api-scenario-config :scenarios="test.scenarioDefinition" ref="config"/>
@ -43,7 +51,7 @@
watch: {
'$route'(to) {
if (to.params.type === "edit") {
if (to.query.id) {
this.getTest(to.query.id);
} else {
this.test = new Test();
@ -75,20 +83,35 @@
saveTest: function () {
this.change = false;
let param = {
id: this.test.id,
projectId: this.test.projectId,
name: this.test.name,
scenarioDefinition: JSON.stringify(this.test.scenarioDefinition)
}
this.result = this.$post("/api/save", param, response => {
this.result = this.$post("/api/save", this.getParam(), response => {
this.test.id = response.data;
this.$message({
message: this.$t('commons.save_success'),
type: 'success'
});
});
},
runTest: function () {
this.change = false;
this.result = this.$post("/api/run", this.getParam(), response => {
this.test.id = response.data;
this.$message({
message: this.$t('commons.save_success'),
type: 'success'
});
});
},
clear: function () {
this.test = new Test();
},
getParam: function () {
return {
id: this.test.id,
projectId: this.test.projectId,
name: this.test.name,
scenarioDefinition: JSON.stringify(this.test.scenarioDefinition)
}
}
},

View File

@ -4,7 +4,7 @@
<el-card>
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="search" :title="$t('commons.test')"
@create="create"/>
@create="create" :createTip="$t('load_test.create')"/>
</template>
<el-table :data="tableData" class="test-content">
<el-table-column

View File

@ -171,6 +171,7 @@ export default {
'resource_pool_is_null': '资源池为空',
},
api_test: {
save_and_run: "保存并执行",
input_name: "请输入测试名称",
select_project: "请选择项目",
scenario: {