feat(接口定义): 案例执行失败详情查看

This commit is contained in:
fit2-zhao 2020-12-11 19:14:54 +08:00
parent 683e4d6b3a
commit 0bd4675886
7 changed files with 111 additions and 13 deletions

View File

@ -39,6 +39,7 @@
@editApi="editApi"
@handleCase="handleCase"
@handleEditBatch="handleEditBatch"
@showExecResult="showExecResult"
ref="apiList"/>
<!-- 添加/编辑测试窗口-->
@ -51,10 +52,10 @@
<!-- 快捷调试 -->
<div v-else-if="item.type=== 'debug'" class="ms-api-div">
<ms-debug-http-page :currentProtocol="currentProtocol" @saveAs="editApi" v-if="currentProtocol==='HTTP'"/>
<ms-debug-jdbc-page :currentProtocol="currentProtocol" @saveAs="editApi" v-if="currentProtocol==='SQL'"/>
<ms-debug-tcp-page :currentProtocol="currentProtocol" @saveAs="editApi" v-if="currentProtocol==='TCP'"/>
<ms-debug-dubbo-page :currentProtocol="currentProtocol" @saveAs="editApi" v-if="currentProtocol==='DUBBO'"/>
<ms-debug-http-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" v-if="currentProtocol==='HTTP'"/>
<ms-debug-jdbc-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" v-if="currentProtocol==='SQL'"/>
<ms-debug-tcp-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" v-if="currentProtocol==='TCP'"/>
<ms-debug-dubbo-page :currentProtocol="currentProtocol" :testCase="item.api" @saveAs="editApi" v-if="currentProtocol==='DUBBO'"/>
</div>
<!-- 测试-->
@ -198,8 +199,8 @@
});
this.apiDefaultTab = newTabName;
},
debug() {
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug");
debug(id) {
this.handleTabsEdit(this.$t('api_test.definition.request.fast_debug'), "debug",id);
},
editApi(row) {
let name = this.$t('api_test.definition.request.edit_api');
@ -256,6 +257,9 @@
},
changeProtocol(data) {
this.currentProtocol = data;
},
showExecResult(row){
this.debug(row);
}
}
}

View File

@ -66,7 +66,10 @@
</el-col>
<el-col :span="3">
<div v-if="item.type!='create'">{{getResult(item.execResult)}}</div>
<el-link type="danger" @click="showExecResult(item)" v-if="item.execResult && item.execResult==='error'">{{getResult(item.execResult)}}</el-link>
<div v-else>
<div v-if="item.type!='create'">{{getResult(item.execResult)}}</div>
</div>
<div v-if="item.type!='create'" style="color: #999999;font-size: 12px">
<span> {{item.updateTime | timestampFormatDate }}</span>
{{item.updateUser}}
@ -388,6 +391,10 @@
},
handleClose() {
this.visible = false;
},
showExecResult(row) {
this.visible = false;
this.$emit('showExecResult', row);
}
}
}

View File

@ -81,7 +81,7 @@
<ms-table-pagination :change="initApiTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
</el-card>
<ms-api-case-list @refresh="initApiTable" :currentApi="selectApi" ref="caseList"/>
<ms-api-case-list @refresh="initApiTable" @showExecResult="showExecResult" :currentApi="selectApi" ref="caseList"/>
</div>
</template>
@ -304,6 +304,9 @@
return this.methodColorMap.get(method);
}
},
showExecResult(row) {
this.$emit('showExecResult', row);
}
},
}
</script>

View File

@ -46,6 +46,7 @@
props: {
currentProtocol: String,
scenario: Boolean,
testCase: {},
},
data() {
return {
@ -66,7 +67,27 @@
}
},
created() {
this.request = createComponent("DubboSampler");
if (this.testCase) {
//
let url = "/api/definition/report/getReport/" + this.testCase.id;
this.$get(url, response => {
if (response.data) {
let data = JSON.parse(response.data.content);
this.responseData = data;
}
});
this.request = this.testCase.request;
if (this.request) {
this.debugForm.method = this.request.method;
if (this.request.url) {
this.debugForm.url = this.request.url;
} else {
this.debugForm.url = this.request.path;
}
}
} else {
this.request = createComponent("DubboSampler");
}
},
watch: {
debugResultId() {

View File

@ -59,6 +59,7 @@
components: {MsRequestResultTail, MsResponseResult, MsApiRequestForm, MsRequestMetric, MsResponseText, MsRun},
props: {
currentProtocol: String,
testCase: {},
scenario: Boolean,
},
data() {
@ -79,12 +80,32 @@
}
},
created() {
this.createHttp();
if (this.testCase) {
//
let url = "/api/definition/report/getReport/" + this.testCase.id;
this.$get(url, response => {
if (response.data) {
let data = JSON.parse(response.data.content);
this.responseData = data;
}
});
this.request = this.testCase.request;
if (this.request) {
this.debugForm.method = this.request.method;
if (this.request.url) {
this.debugForm.url = this.request.url;
} else {
this.debugForm.url = this.request.path;
}
}
} else {
this.createHttp();
}
},
watch: {
debugResultId() {
this.getResult()
}
},
},
methods: {
handleCommand(e) {

View File

@ -48,6 +48,7 @@
props: {
currentProtocol: String,
scenario: Boolean,
testCase: {},
},
data() {
return {
@ -68,7 +69,27 @@
}
},
created() {
this.request = createComponent("JDBCSampler");
if (this.testCase) {
//
let url = "/api/definition/report/getReport/" + this.testCase.id;
this.$get(url, response => {
if (response.data) {
let data = JSON.parse(response.data.content);
this.responseData = data;
}
});
this.request = this.testCase.request;
if (this.request) {
this.debugForm.method = this.request.method;
if (this.request.url) {
this.debugForm.url = this.request.url;
} else {
this.debugForm.url = this.request.path;
}
}
} else {
this.request = createComponent("JDBCSampler");
}
},
watch: {
debugResultId() {

View File

@ -47,6 +47,7 @@
props: {
currentProtocol: String,
scenario: Boolean,
testCase: {},
},
data() {
return {
@ -67,7 +68,27 @@
}
},
created() {
this.request = createComponent("TCPSampler");
if (this.testCase) {
//
let url = "/api/definition/report/getReport/" + this.testCase.id;
this.$get(url, response => {
if (response.data) {
let data = JSON.parse(response.data.content);
this.responseData = data;
}
});
this.request = this.testCase.request;
if (this.request) {
this.debugForm.method = this.request.method;
if (this.request.url) {
this.debugForm.url = this.request.url;
} else {
this.debugForm.url = this.request.path;
}
}
} else {
this.request = createComponent("TCPSampler");
}
},
watch: {
debugResultId() {