提交 1294739d 编写于 作者: Q q4speed

run button

上级 39fc9394
......@@ -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);
}
}
......@@ -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());
......
......@@ -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", 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/save", param, response => {
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)
}
}
},
......
......@@ -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
......
......@@ -171,6 +171,7 @@ export default {
'resource_pool_is_null': '资源池为空',
},
api_test: {
save_and_run: "保存并执行",
input_name: "请输入测试名称",
select_project: "请选择项目",
scenario: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册