fix(接口自动化): 循环结果放到各自请求中
This commit is contained in:
parent
bd12a36af5
commit
039898c635
|
@ -34,7 +34,16 @@
|
||||||
<ms-dubbo-basis-parameters :request="request" v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'" :showScript="false"/>
|
<ms-dubbo-basis-parameters :request="request" v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'|| request.type==='DubboSampler'" :showScript="false"/>
|
||||||
|
|
||||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
||||||
<api-response-component :currentProtocol="request.protocol" :result="request.requestResult"/>
|
<div v-if="request.result">
|
||||||
|
<el-tabs v-model="request.activeName" closable class="ms-tabs">
|
||||||
|
<el-tab-pane :label="item.name" :name="item.name" v-for="(item,index) in request.result.scenarios" :key="index">
|
||||||
|
<div v-for="(result,i) in item.requestResults" :key="i" style="margin-bottom: 5px">
|
||||||
|
<api-response-component v-if="result.name===request.name" :result="result"/>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</div>
|
||||||
|
<api-response-component :currentProtocol="request.protocol" :result="request.requestResult" v-else/>
|
||||||
|
|
||||||
<!-- 保存操作 -->
|
<!-- 保存操作 -->
|
||||||
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(item)" v-if="!request.referenced">
|
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(item)" v-if="!request.referenced">
|
||||||
|
@ -86,6 +95,7 @@
|
||||||
if (!this.request.requestResult) {
|
if (!this.request.requestResult) {
|
||||||
this.request.requestResult = {responseResult: {}};
|
this.request.requestResult = {responseResult: {}};
|
||||||
}
|
}
|
||||||
|
console.log(this.request)
|
||||||
// 加载引用对象数据
|
// 加载引用对象数据
|
||||||
this.getApiInfo();
|
this.getApiInfo();
|
||||||
if (this.request.protocol === 'HTTP') {
|
if (this.request.protocol === 'HTTP') {
|
||||||
|
@ -155,7 +165,7 @@
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
remove() {
|
remove() {
|
||||||
|
@ -247,6 +257,7 @@
|
||||||
},
|
},
|
||||||
runRefresh(data) {
|
runRefresh(data) {
|
||||||
this.request.requestResult = data;
|
this.request.requestResult = data;
|
||||||
|
this.request.result = undefined;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
reload() {
|
reload() {
|
||||||
|
@ -289,4 +300,9 @@
|
||||||
.icon.is-active {
|
.icon.is-active {
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ms-tabs >>> .el-icon-close:before {
|
||||||
|
content: "";
|
||||||
|
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -79,17 +79,17 @@
|
||||||
<el-input-number size="small" v-model="controller.whileController.timeout" :placeholder="$t('commons.millisecond')" :max="1000*10000000" :min="3000" :step="1000"/>
|
<el-input-number size="small" v-model="controller.whileController.timeout" :placeholder="$t('commons.millisecond')" :max="1000*10000000" :min="3000" :step="1000"/>
|
||||||
<span class="ms-span ms-radio">ms</span>
|
<span class="ms-span ms-radio">ms</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>
|
<!--<p class="tip">{{$t('api_test.definition.request.res_param')}} </p>-->
|
||||||
<div>
|
<!--<div>-->
|
||||||
<el-tabs v-model="activeName" closable class="ms-tabs">
|
<!--<el-tabs v-model="activeName" closable class="ms-tabs">-->
|
||||||
<el-tab-pane :label="item.name" :name="item.name" v-for="(item,index) in requestResult.scenarios" :key="index">
|
<!--<el-tab-pane :label="item.name" :name="item.name" v-for="(item,index) in requestResult.scenarios" :key="index">-->
|
||||||
<div v-for="(result,i) in item.requestResults" :key="i" style="margin-bottom: 5px">
|
<!--<div v-for="(result,i) in item.requestResults" :key="i" style="margin-bottom: 5px">-->
|
||||||
<api-response-component :result="result"/>
|
<!--<api-response-component :result="result"/>-->
|
||||||
</div>
|
<!--</div>-->
|
||||||
</el-tab-pane>
|
<!--</el-tab-pane>-->
|
||||||
</el-tabs>
|
<!--</el-tabs>-->
|
||||||
|
|
||||||
</div>
|
<!--</div>-->
|
||||||
|
|
||||||
</api-base-component>
|
</api-base-component>
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.initResult();
|
// this.initResult();
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -202,7 +202,6 @@
|
||||||
this.$warning("当前循环下没有请求,不能执行")
|
this.$warning("当前循环下没有请求,不能执行")
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.controller.active = true;
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.debugData = {
|
this.debugData = {
|
||||||
id: this.currentScenario.id, name: this.currentScenario.name, type: "scenario",
|
id: this.currentScenario.id, name: this.currentScenario.name, type: "scenario",
|
||||||
|
@ -224,7 +223,7 @@
|
||||||
},
|
},
|
||||||
changeRadio() {
|
changeRadio() {
|
||||||
this.controller.active = true;
|
this.controller.active = true;
|
||||||
this.initResult();
|
//this.initResult();
|
||||||
this.reload();
|
this.reload();
|
||||||
},
|
},
|
||||||
change(value) {
|
change(value) {
|
||||||
|
@ -258,6 +257,20 @@
|
||||||
this.success = this.requestResult.scenarios && this.requestResult.scenarios != null ? this.requestResult.scenarios.length - this.error : 0;
|
this.success = this.requestResult.scenarios && this.requestResult.scenarios != null ? this.requestResult.scenarios.length - this.error : 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setResult(hashTree) {
|
||||||
|
if (hashTree) {
|
||||||
|
hashTree.forEach(item => {
|
||||||
|
if (item.type === "HTTPSamplerProxy" || item.type === "DubboSampler" || item.type === "JDBCSampler" || item.type === "TCPSampler") {
|
||||||
|
item.result = this.requestResult;
|
||||||
|
item.activeName = this.activeName;
|
||||||
|
item.requestResult = undefined;
|
||||||
|
}
|
||||||
|
if (item.hashTree && item.hashTree.length > 0) {
|
||||||
|
this.setResult(item.hashTree);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
getReport() {
|
getReport() {
|
||||||
if (this.reportId) {
|
if (this.reportId) {
|
||||||
let url = "/api/scenario/report/get/" + this.reportId;
|
let url = "/api/scenario/report/get/" + this.reportId;
|
||||||
|
@ -285,11 +298,14 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.getFails();
|
this.getFails();
|
||||||
|
this.activeName = this.requestResult && this.requestResult.scenarios && this.requestResult.scenarios != null && this.requestResult.scenarios.length > 0 ? this.requestResult.scenarios[0].name : "";
|
||||||
|
// 把请求结果分给各个请求
|
||||||
|
this.setResult(this.controller.hashTree);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.activeName = this.requestResult && this.requestResult.scenarios && this.requestResult.scenarios != null && this.requestResult.scenarios.length > 0 ? this.requestResult.scenarios[0].name : "";
|
this.reload();
|
||||||
} else {
|
} else {
|
||||||
setTimeout(this.getReport, 2000)
|
setTimeout(this.getReport, 2000)
|
||||||
}
|
}
|
||||||
|
@ -333,11 +349,6 @@
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ms-tabs >>> .el-icon-close:before {
|
|
||||||
content: "";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon.is-active {
|
.icon.is-active {
|
||||||
transform: rotate(90deg);
|
transform: rotate(90deg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue