fix(接口定义): 修复自定义tcp没名字时无法执行的缺陷 (#18101)
--bug=1017030 --user=王孝刚 【接口测试】接口自动化自定义请求,TCP请求不填写名称创建后无法运行 https://www.tapd.cn/55049933/s/1247550 Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
parent
f6fc250bce
commit
4b2b61eaac
|
@ -180,6 +180,9 @@ public class MsDubboSampler extends MsTestElement {
|
||||||
DubboSample sampler = new DubboSample();
|
DubboSample sampler = new DubboSample();
|
||||||
sampler.setEnabled(this.isEnable());
|
sampler.setEnabled(this.isEnable());
|
||||||
sampler.setName(this.getName());
|
sampler.setName(this.getName());
|
||||||
|
if (StringUtils.isEmpty(this.getName())) {
|
||||||
|
sampler.setName("DubboSamplerProxy");
|
||||||
|
}
|
||||||
if (config.isOperating()) {
|
if (config.isOperating()) {
|
||||||
String[] testNameArr = sampler.getName().split("<->");
|
String[] testNameArr = sampler.getName().split("<->");
|
||||||
if (testNameArr.length > 0) {
|
if (testNameArr.length > 0) {
|
||||||
|
|
|
@ -285,6 +285,9 @@ public class MsTCPSampler extends MsTestElement {
|
||||||
TCPSampler tcpSampler = new TCPSampler();
|
TCPSampler tcpSampler = new TCPSampler();
|
||||||
tcpSampler.setEnabled(this.isEnable());
|
tcpSampler.setEnabled(this.isEnable());
|
||||||
tcpSampler.setName(this.getName());
|
tcpSampler.setName(this.getName());
|
||||||
|
if (StringUtils.isEmpty(this.getName())) {
|
||||||
|
tcpSampler.setName("TcpSamplerProxy");
|
||||||
|
}
|
||||||
if (config.isOperating()) {
|
if (config.isOperating()) {
|
||||||
String[] testNameArr = tcpSampler.getName().split("<->");
|
String[] testNameArr = tcpSampler.getName().split("<->");
|
||||||
if (testNameArr.length > 0) {
|
if (testNameArr.length > 0) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-card>
|
<el-card>
|
||||||
<el-form :model="request" :rules="rules" label-width="auto" ref="request">
|
<el-form ref="request" :model="request" label-width="auto">
|
||||||
<el-form-item :label="$t('api_test.request.name')" prop="name">
|
<el-form-item :label="$t('api_test.request.name')" prop="name">
|
||||||
<el-input v-model="request.name" maxlength="200" show-word-limit size="small"/>
|
<el-input v-model="request.name" maxlength="200" show-word-limit size="small"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -13,74 +13,75 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<!--不同协议请求-->
|
<!--不同协议请求-->
|
||||||
<ms-debug-http-page :scenario="true" :current-api="request" @saveAs="editApi" :currentProtocol="request.protocol" v-if="request.protocol==='HTTP'"/>
|
<ms-debug-http-page v-if="request.protocol==='HTTP'" :current-api="request" :currentProtocol="request.protocol"
|
||||||
<ms-debug-jdbc-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" v-if="request.protocol==='SQL'"/>
|
:scenario="true"
|
||||||
<ms-debug-tcp-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" v-if="request.protocol==='TCP'"/>
|
@saveAs="editApi"/>
|
||||||
<ms-debug-dubbo-page :scenario="true" :currentProtocol="request.protocol" @saveAs="editApi" v-if="request.protocol==='DUBBO'"/>
|
<ms-debug-jdbc-page v-if="request.protocol==='SQL'" :currentProtocol="request.protocol" :scenario="true"
|
||||||
|
@saveAs="editApi"/>
|
||||||
|
<ms-debug-tcp-page v-if="request.protocol==='TCP'" :currentProtocol="request.protocol" :scenario="true"
|
||||||
|
@saveAs="editApi"/>
|
||||||
|
<ms-debug-dubbo-page v-if="request.protocol==='DUBBO'" :currentProtocol="request.protocol" :scenario="true"
|
||||||
|
@saveAs="editApi"/>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsDebugHttpPage from "../../definition/components/debug/DebugHttpPage";
|
import MsDebugHttpPage from "../../definition/components/debug/DebugHttpPage";
|
||||||
import MsDebugJdbcPage from "../../definition/components/debug/DebugJdbcPage";
|
import MsDebugJdbcPage from "../../definition/components/debug/DebugJdbcPage";
|
||||||
import MsDebugTcpPage from "../../definition/components/debug/DebugTcpPage";
|
import MsDebugTcpPage from "../../definition/components/debug/DebugTcpPage";
|
||||||
import MsDebugDubboPage from "../../definition/components/debug/DebugDubboPage";
|
import MsDebugDubboPage from "../../definition/components/debug/DebugDubboPage";
|
||||||
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
import {getCurrentProjectID, getUUID} from "@/common/js/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ApiCustomize",
|
name: "ApiCustomize",
|
||||||
props: {
|
props: {
|
||||||
node: {},
|
node: {},
|
||||||
request: {},
|
request: {},
|
||||||
},
|
},
|
||||||
components: {MsDebugHttpPage, MsDebugJdbcPage, MsDebugTcpPage, MsDebugDubboPage},
|
components: {MsDebugHttpPage, MsDebugJdbcPage, MsDebugTcpPage, MsDebugDubboPage},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
rules: {
|
|
||||||
name: [{required: true, message: this.$t('commons.input_name'), trigger: 'blur'}],
|
|
||||||
protocol: [{required: true, message: this.$t('commons.please_select'), trigger: 'blur'}],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
remove() {
|
|
||||||
this.$emit('remove', this.request, this.node);
|
|
||||||
},
|
|
||||||
active(item) {
|
|
||||||
item.active = !item.active;
|
|
||||||
this.reload();
|
|
||||||
},
|
|
||||||
editApi(row) {
|
|
||||||
let name = this.request.name;
|
|
||||||
Object.assign(this.request, row.request);
|
|
||||||
this.request.name = name;
|
|
||||||
if (this.request.protocol === 'HTTP') {
|
|
||||||
if (row.url) {
|
|
||||||
// 自定义请求根据是否勾选判断是否需要引用环境
|
|
||||||
this.request.url = row.url;
|
|
||||||
this.request.path = row.url;
|
|
||||||
} else {
|
|
||||||
this.request.url = row.path;
|
|
||||||
this.request.path = row.path;
|
|
||||||
}
|
|
||||||
this.request.method = row.method;
|
|
||||||
}
|
|
||||||
this.request.resourceId = getUUID();
|
|
||||||
this.request.projectId = getCurrentProjectID();
|
|
||||||
let obj = {};
|
|
||||||
Object.assign(obj, this.request);
|
|
||||||
this.$emit('addCustomizeApi', obj);
|
|
||||||
},
|
|
||||||
reload() {
|
|
||||||
this.loading = true
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.loading = false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
remove() {
|
||||||
|
this.$emit('remove', this.request, this.node);
|
||||||
|
},
|
||||||
|
active(item) {
|
||||||
|
item.active = !item.active;
|
||||||
|
this.reload();
|
||||||
|
},
|
||||||
|
editApi(row) {
|
||||||
|
let name = this.request.name;
|
||||||
|
Object.assign(this.request, row.request);
|
||||||
|
this.request.name = name;
|
||||||
|
if (this.request.protocol === 'HTTP') {
|
||||||
|
if (row.url) {
|
||||||
|
// 自定义请求根据是否勾选判断是否需要引用环境
|
||||||
|
this.request.url = row.url;
|
||||||
|
this.request.path = row.url;
|
||||||
|
} else {
|
||||||
|
this.request.url = row.path;
|
||||||
|
this.request.path = row.path;
|
||||||
|
}
|
||||||
|
this.request.method = row.method;
|
||||||
|
}
|
||||||
|
this.request.resourceId = getUUID();
|
||||||
|
this.request.projectId = getCurrentProjectID();
|
||||||
|
let obj = {};
|
||||||
|
Object.assign(obj, this.request);
|
||||||
|
this.$emit('addCustomizeApi', obj);
|
||||||
|
},
|
||||||
|
reload() {
|
||||||
|
this.loading = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
Loading…
Reference in New Issue