allure-java icon indicating copy to clipboard operation
allure-java copied to clipboard

Add request and response time to HttpResponseAttachment/HttpRequestAttachment

Open artsok opened this issue 6 years ago • 3 comments

Context

When QAs check Allure reports, they want to see the time in the attachment when HTTP requests or responses made. I clearly understand that they could check Jenkin's log, but it's not useful and has time-consuming. For that reason, I added a request/response time to HTTP attachment. Look like:

image

Checklist

artsok avatar Oct 15 '19 16:10 artsok

what about zone? Often server that run tests located in different time zone, so you'll get wrong time

baev avatar Oct 15 '19 16:10 baev

@baev

Yep, I think ZonedDateTime.now(ZoneId.systemDefault()) will be better. Like this: 2019-10-16T13:58:47.540+03:00[Europe/Moscow]

What do you think? Maybe you have another thought about how to make correctly?

artsok avatar Oct 16 '19 11:10 artsok

Sorry for the delay

I think it would be actually better to use timestamp in epoch milliseconds (as a Long Java type) for request/response times.

Then you can use freemarker ?number_to_datetime function to pretty print date. https://freemarker.apache.org/docs/ref_builtins_expert.html#ref_builtin_numToDate

That will add possibility to use different time representation for users with custom request/response templates

Then, it would be nice to have a possibility to set request/response timings by passing value to the builder

baev avatar Dec 09 '19 10:12 baev