feat(接口测试): 报告里增加请求开始时间

This commit is contained in:
q4speed 2020-09-25 17:25:13 +08:00
parent 2b2ebb6823
commit e7f8c25a70
7 changed files with 24 additions and 5 deletions

View File

@ -141,6 +141,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
requestResult.setBody(result.getSamplerData());
requestResult.setHeaders(result.getRequestHeaders());
requestResult.setRequestSize(result.getSentBytes());
requestResult.setStartTime(result.getStartTime());
requestResult.setTotalAssertions(result.getAssertionResults().length);
requestResult.setSuccess(result.isSuccessful());
requestResult.setError(result.getErrorCount());

View File

@ -16,6 +16,8 @@ public class RequestResult {
private long requestSize;
private long startTime;
private int error;
private boolean success;

View File

@ -2,10 +2,13 @@
<div class="request-result">
<div @click="active">
<el-row :gutter="10" type="flex" align="middle" class="info">
<el-col :span="16">
<el-col :span="12">
<i class="icon el-icon-arrow-right" :class="{'is-active': isActive}"/>
{{scenarioName}}
</el-col>
<el-col :span="4">
{{$t('api_report.start_time')}}
</el-col>
<el-col :span="2">
{{$t('api_report.response_time')}}
</el-col>
@ -20,17 +23,20 @@
</el-col>
</el-row>
<el-row :gutter="10" type="flex" align="middle" class="info">
<el-col :span="4">
<el-col :span="2">
<div class="method">
{{request.method}}
</div>
</el-col>
<el-col :span="12">
<el-col :span="10">
<div class="name">{{request.name}}</div>
<el-tooltip effect="dark" :content="request.url" placement="bottom" :open-delay="800">
<div class="url">{{request.url}}</div>
</el-tooltip>
</el-col>
<el-col :span="4">
{{request.startTime | timestampFormatDate(true) }}
</el-col>
<el-col :span="2">
<div class="time">
{{request.responseResult.responseTime}}

View File

@ -10,7 +10,7 @@ const options = function (value, array) {
return value;
};
const timestampFormatDate = function (timestamp) {
const timestampFormatDate = function (timestamp, showMs) {
if (!timestamp) {
return timestamp
}
@ -34,7 +34,14 @@ const timestampFormatDate = function (timestamp) {
let s = date.getSeconds();
s = s < 10 ? ('0' + s) : s;
return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
let format = y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
if (showMs === true) {
let ms = date.getMilliseconds();
format += ':' + ms
}
return format
};
const filters = {

View File

@ -598,6 +598,7 @@ export default {
scenario_name: "Scenario name",
response_time: "Response time(ms)",
latency: "Latency",
start_time: "Start Time",
request_size: "Request Size",
response_size: "Response Size",
response_code: "Response Code",

View File

@ -598,6 +598,7 @@ export default {
delete_confirm: '确认删除报告: ',
delete_batch_confirm: '确认批量删除报告',
scenario_name: "场景名称",
start_time: "开始时间",
response_time: "响应时间(ms)",
latency: "网络延迟",
request_size: "请求大小",

View File

@ -598,6 +598,7 @@ export default {
delete_confirm: '確認刪除報告: ',
delete_batch_confirm: '確認批量刪除報告',
scenario_name: "場景名稱",
start_time: "開始時間",
response_time: "響應時間(ms)",
latency: "網絡延遲",
request_size: "請求大小",