feat(接口定义): SQL协议快捷调试
This commit is contained in:
parent
8db0b4349a
commit
948fcdb3b8
|
@ -264,6 +264,8 @@ public class ApiDefinitionService {
|
|||
createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
|
||||
HashTree hashTree = request.getTestElement().generateHashTree();
|
||||
|
||||
request.getTestElement().getJmx(hashTree);
|
||||
// 调用执行方法
|
||||
jMeterService.runDefinition(request.getId(), hashTree, request.getReportId(), ApiRunMode.DELIMIT.name());
|
||||
return request.getId();
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
|
||||
<!-- 快捷调试 -->
|
||||
<div v-else-if="item.type=== 'debug'">
|
||||
<ms-debug-http-page :currentProtocol="currentProtocol" @saveAs="editApi"/>
|
||||
<ms-debug-http-page :currentProtocol="currentProtocol" @saveAs="editApi" v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-debug-jdbc-page :currentProtocol="currentProtocol" :currentProject="currentProject" @saveAs="editApi" v-if="currentProtocol==='SQL'"/>
|
||||
</div>
|
||||
|
||||
<!-- 测试-->
|
||||
|
@ -68,6 +69,8 @@
|
|||
import MsBottomContainer from "./components/BottomContainer";
|
||||
import MsApiConfig from "./components/ApiConfig";
|
||||
import MsDebugHttpPage from "./components/debug/DebugHttpPage";
|
||||
import MsDebugJdbcPage from "./components/debug/DebugJdbcPage";
|
||||
|
||||
import MsRunTestHttpPage from "./components/runtest/RunTestHttpPage";
|
||||
import {downloadFile, getCurrentUser, getUUID} from "@/common/js/utils";
|
||||
|
||||
|
@ -82,7 +85,8 @@
|
|||
MsBottomContainer,
|
||||
MsApiConfig,
|
||||
MsDebugHttpPage,
|
||||
MsRunTestHttpPage
|
||||
MsRunTestHttpPage,
|
||||
MsDebugJdbcPage
|
||||
},
|
||||
comments: {},
|
||||
data() {
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
this.runData.forEach(item => {
|
||||
threadGroup.hashTree.push(item);
|
||||
})
|
||||
console.log(testPlan)
|
||||
let reqObj = {id: this.reportId, testElement: testPlan};
|
||||
let bodyFiles = this.getBodyUploadFiles(reqObj);
|
||||
let url = "";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
|
||||
<div class="card-container">
|
||||
<div class="card-container" v-loading="loading">
|
||||
<el-card class="card-content">
|
||||
<el-form :model="debugForm" :rules="rules" ref="debugForm" :inline="true" label-position="right">
|
||||
<p class="tip">{{$t('test_track.plan_view.base_info')}} </p>
|
||||
|
@ -31,7 +31,7 @@
|
|||
</el-form>
|
||||
<!-- HTTP 请求返回数据 -->
|
||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
||||
<ms-request-result-tail v-loading="loading" :response="responseData" ref="debugResult"/>
|
||||
<ms-request-result-tail :response="responseData" ref="debugResult"/>
|
||||
|
||||
<!-- 执行组件 -->
|
||||
<ms-run :debug="true" :reportId="reportId" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
|
||||
|
|
|
@ -1,37 +1,23 @@
|
|||
<template>
|
||||
|
||||
<div class="card-container">
|
||||
<div class="card-container" v-loading="loading">
|
||||
<el-card class="card-content">
|
||||
<el-form :model="debugForm" :rules="rules" ref="debugForm" :inline="true" label-position="right">
|
||||
<p class="tip">{{$t('test_track.plan_view.base_info')}} </p>
|
||||
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand"
|
||||
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
|
||||
{{$t('commons.test')}}
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="save_as">{{$t('api_test.definition.request.save_as')}}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
<el-form-item :label="$t('api_report.request')" prop="url">
|
||||
<el-input :placeholder="$t('api_test.definition.request.path_all_info')" v-model="debugForm.url"
|
||||
class="ms-http-input" size="small">
|
||||
<el-select v-model="debugForm.method" slot="prepend" style="width: 100px" size="small">
|
||||
<el-option v-for="item in reqOptions" :key="item.id" :label="item.label" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<!-- HTTP 请求参数 -->
|
||||
<ms-basis-parameters :request="request" :currentProject="currentProject"/>
|
||||
|
||||
<el-form-item>
|
||||
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand"
|
||||
@command="handleCommand" size="small">
|
||||
{{$t('commons.test')}}
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="save_as">{{$t('api_test.definition.request.save_as')}}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-form-item>
|
||||
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<!-- HTTP 请求参数 -->
|
||||
<ms-api-request-form :headers="headers" :request="request"/>
|
||||
|
||||
</el-form>
|
||||
<!-- HTTP 请求返回数据 -->
|
||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
||||
<ms-request-result-tail v-loading="loading" :response="responseData" ref="debugResult"/>
|
||||
<ms-request-result-tail :response="responseData" ref="debugResult"/>
|
||||
|
||||
<!-- 执行组件 -->
|
||||
<ms-run :debug="true" :reportId="reportId" :run-data="runData" @runRefresh="runRefresh" ref="runTest"/>
|
||||
|
@ -50,12 +36,14 @@
|
|||
import HeaderManager from "../jmeter/components/configurations/header-manager";
|
||||
import {REQ_METHOD} from "../../model/JsonData";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
import MsBasisParameters from "../request/database/BasisParameters";
|
||||
|
||||
export default {
|
||||
name: "ApiConfig",
|
||||
components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun},
|
||||
components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun, MsBasisParameters},
|
||||
props: {
|
||||
currentProtocol: String,
|
||||
currentProject: {},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -76,9 +64,9 @@
|
|||
}
|
||||
},
|
||||
created() {
|
||||
switch (this.protocol) {
|
||||
switch (this.currentProtocol) {
|
||||
case Request.TYPES.SQL:
|
||||
this.request = createComponent("SQL");
|
||||
this.request = createComponent("JDBCSampler");
|
||||
break;
|
||||
case Request.TYPES.DUBBO:
|
||||
this.request = createComponent("JDBCSampler");
|
||||
|
@ -110,19 +98,12 @@
|
|||
this.request.hashTree = [header];
|
||||
},
|
||||
runDebug() {
|
||||
this.$refs['debugForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
this.request.url = this.debugForm.url;
|
||||
this.request.method = this.debugForm.method;
|
||||
this.request.hashTree[0].headers = this.headers;
|
||||
this.request.name = getUUID().substring(0, 8);
|
||||
this.runData = [];
|
||||
this.runData.push(this.request);
|
||||
/*触发执行操作*/
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
}
|
||||
})
|
||||
this.loading = true;
|
||||
this.request.name = getUUID().substring(0, 8);
|
||||
this.runData = [];
|
||||
this.runData.push(this.request);
|
||||
/*触发执行操作*/
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
},
|
||||
runRefresh(data) {
|
||||
this.responseData = data;
|
||||
|
|
|
@ -5,38 +5,43 @@
|
|||
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100% ;margin: 20px">
|
||||
<el-form :model="request" ref="request" label-width="100px" :disabled="isReadOnly" style="margin: 20px">
|
||||
|
||||
<div class="one-row">
|
||||
<el-form-item prop="environmentId" :label="$t('api_test.definition.request.run_env')">
|
||||
<el-select v-model="request.environmentId" size="small" class="ms-htt-width"
|
||||
:placeholder="$t('api_test.definition.request.run_env')"
|
||||
@change="environmentChange" clearable>
|
||||
<el-option v-for="(environment, index) in environments" :key="index"
|
||||
:label="environment.name + (environment.config.httpConfig.socket ? (': ' + environment.config.httpConfig.protocol + '://' + environment.config.httpConfig.socket) : '')"
|
||||
:value="environment.id"/>
|
||||
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">
|
||||
{{ $t('api_test.environment.environment_config') }}
|
||||
</el-button>
|
||||
<template v-slot:empty>
|
||||
<div class="empty-environment">
|
||||
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">
|
||||
{{ $t('api_test.environment.environment_config') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item prop="environmentId" :label="$t('api_test.definition.request.run_env')">
|
||||
<el-select v-model="request.environmentId" size="small" class="ms-htt-width"
|
||||
:placeholder="$t('api_test.definition.request.run_env')"
|
||||
@change="environmentChange" clearable>
|
||||
<el-option v-for="(environment, index) in environments" :key="index"
|
||||
:label="environment.name + (environment.config.httpConfig.socket ? (': ' + environment.config.httpConfig.protocol + '://' + environment.config.httpConfig.socket) : '')"
|
||||
:value="environment.id"/>
|
||||
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">
|
||||
{{ $t('api_test.environment.environment_config') }}
|
||||
</el-button>
|
||||
<template v-slot:empty>
|
||||
<div class="empty-environment">
|
||||
<el-button class="environment-button" size="mini" type="primary" @click="openEnvironmentConfig">
|
||||
{{ $t('api_test.environment.environment_config') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('api_test.request.sql.dataSource')" prop="dataSource" style="margin-left: 10px">
|
||||
<el-select v-model="request.dataSource" size="small">
|
||||
<el-option v-for="(item, index) in databaseConfigsOptions" :key="index" :value="item" :label="item.name"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('api_test.request.sql.dataSource')" prop="dataSource" style="margin-left: 10px">
|
||||
<el-select v-model="request.dataSource" size="small">
|
||||
<el-option v-for="(item, index) in databaseConfigsOptions" :key="index" :value="item" :label="item.name"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item :label="$t('api_test.request.sql.timeout')" prop="queryTimeout" style="margin-left: 10px">
|
||||
<el-input-number :disabled="isReadOnly" size="small" v-model="request.queryTimeout" :placeholder="$t('commons.millisecond')" :max="1000*10000000" :min="0"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form-item :label="$t('api_test.request.sql.timeout')" prop="queryTimeout" style="margin-left: 10px">
|
||||
<el-input-number :disabled="isReadOnly" size="small" v-model="request.queryTimeout" :placeholder="$t('commons.millisecond')" :max="1000*10000000" :min="0"/>
|
||||
</el-form-item>
|
||||
|
||||
</div>
|
||||
|
||||
<el-form-item :label="$t('api_test.request.sql.result_variable')" prop="resultVariable">
|
||||
<el-input v-model="request.resultVariable" maxlength="300" show-word-limit/>
|
||||
|
|
Loading…
Reference in New Issue