fix(接口测试): 接口自动化报告总时间计算错误
--bug=1008828 --user=王孝刚 接口自动化报告总时间计算错误 https://www.tapd.cn/55049933/s/1080731
This commit is contained in:
parent
f84d8e0e5e
commit
74de0c09ac
|
@ -360,20 +360,22 @@ export default {
|
|||
},
|
||||
computeTotalTime() {
|
||||
if (this.content.scenarios) {
|
||||
let startTime = 99991611737506593;
|
||||
let startTime = 0;
|
||||
let endTime = 0;
|
||||
let requestTime = 0;
|
||||
this.content.scenarios.forEach((scenario) => {
|
||||
scenario.requestResults.forEach((request) => {
|
||||
if (request.startTime && Number(request.startTime) < startTime) {
|
||||
if (request.startTime && Number(request.startTime)) {
|
||||
startTime = request.startTime;
|
||||
}
|
||||
if (request.endTime && Number(request.endTime) > endTime) {
|
||||
if (request.endTime && Number(request.endTime)) {
|
||||
endTime = request.endTime;
|
||||
}
|
||||
requestTime = requestTime + (endTime - startTime);
|
||||
})
|
||||
})
|
||||
if (startTime < endTime) {
|
||||
this.totalTime = endTime - startTime + 100;
|
||||
this.totalTime = requestTime
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -300,8 +300,9 @@ export default {
|
|||
},
|
||||
formatResult(res) {
|
||||
let resMap = new Map;
|
||||
this.startTime = 99991611737506593;
|
||||
this.startTime = 0;
|
||||
this.endTime = 0;
|
||||
let requestTime = 0;
|
||||
this.clearDebug();
|
||||
if (res && res.scenarios) {
|
||||
res.scenarios.forEach(item => {
|
||||
|
@ -330,20 +331,20 @@ export default {
|
|||
} else {
|
||||
this.reqError++;
|
||||
}
|
||||
if (req.startTime && Number(req.startTime) < this.startTime) {
|
||||
if (req.startTime && Number(req.startTime)) {
|
||||
this.startTime = req.startTime;
|
||||
}
|
||||
if (req.endTime && Number(req.endTime) > this.endTime) {
|
||||
if (req.endTime && Number(req.endTime)) {
|
||||
this.endTime = req.endTime;
|
||||
}
|
||||
requestTime = requestTime + (this.endTime - this.startTime)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if (this.startTime < this.endTime) {
|
||||
this.totalTime = this.endTime - this.startTime + 100;
|
||||
}
|
||||
this.totalTime = requestTime;
|
||||
|
||||
this.debugResult = resMap;
|
||||
this.setTreeValue(this.fullTreeNodes);
|
||||
this.reload();
|
||||
|
|
|
@ -134,17 +134,16 @@
|
|||
},
|
||||
methods: {
|
||||
initTime() {
|
||||
this.time = this.totalTime
|
||||
this.seconds = Math.floor(this.time / 1000)
|
||||
this.time = this.totalTime;
|
||||
this.seconds = (this.time) / 1000;
|
||||
if (this.seconds >= 1) {
|
||||
if (this.seconds > 60) {
|
||||
this.minutes = Math.round(this.time / 60)
|
||||
this.seconds = Math.round(this.time % 60)
|
||||
this.time = this.minutes + "min" + this.seconds + "s"
|
||||
if (this.seconds < 60) {
|
||||
this.seconds = Math.round(this.seconds * 100 / 1) / 100;
|
||||
this.time = this.seconds + "s"
|
||||
}
|
||||
if (this.seconds > 60) {
|
||||
this.minutes = Math.round(this.time / 60)
|
||||
this.seconds = Math.round(this.time % 60)
|
||||
this.minutes = Math.round(this.seconds / 60)
|
||||
this.seconds = Math.round(this.seconds * 100 % 60) / 100;
|
||||
this.time = this.minutes + "min" + this.seconds + "s"
|
||||
}
|
||||
if (this.minutes > 60) {
|
||||
|
@ -153,7 +152,6 @@
|
|||
this.time = this.hour + "hour" + this.minutes + "min" + this.seconds + "s"
|
||||
}
|
||||
|
||||
this.time = (this.seconds) + "s"
|
||||
} else {
|
||||
this.time = this.totalTime + "ms"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue