fix(接口测试): 修复不同节点执行时区不一致情况下报告时间错误问题

--bug=1010397 --user=赵勇 case列表 并行执行  集合报告 选择资源池 执行时间过长 https://www.tapd.cn/55049933/s/1106305
This commit is contained in:
fit2-zhao 2022-02-21 10:00:49 +08:00 committed by fit2-zhao
parent 06a323f15d
commit d01b9956bb
2 changed files with 3 additions and 1 deletions

View File

@ -66,7 +66,6 @@ public class ApiDefinitionExecResultService {
LoggerUtil.info("接收到API/CASE执行结果【 " + requestResults.size() + "");
for (RequestResult item : requestResults) {
item.setEndTime(System.currentTimeMillis());
if (item.getResponseResult() != null && item.getResponseResult().getResponseTime() <= 0) {
item.getResponseResult().setResponseTime((item.getEndTime() - item.getStartTime()));
}

View File

@ -195,6 +195,9 @@ public class ApiScenarioReportStructureService {
} else if (step.getValue() != null) {
if (step.getValue().getStartTime() == 0 || step.getValue().getEndTime() == 0) {
totalTime.set(totalTime.longValue() + 0);
} else if (step.getValue().getStartTime() > step.getValue().getEndTime() && step.getValue().getResponseResult() != null) {
// 异常时间处理
totalTime.set(totalTime.longValue() + step.getValue().getResponseResult().getResponseTime());
} else {
totalTime.set((totalTime.longValue() + (step.getValue().getEndTime() - step.getValue().getStartTime())));
}