How to get the start time of a request and of the response in groovy script ?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to get the start time of a request and of the response in groovy script ?
Hello eveyrone !
I have been searching a lot about that and didn't find an answer. I would like to know how in groovy script, I can have the time of whenthe request was send and the time of when the response was send ?
Thanx in advance for your help !
Luc.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a way to get the time the request was sent and how long it took to get a respose. You can add those two together to get the response time.
Class RestResponseMessageExchange
messageExchange.getTimestamp() messageExchange.getTimeTaken()
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I wrote about something similar at https://community.smartbear.com/t5/SoapUI-Pro/Sharing-is-caring-groovy-script-to-log-the-test-execut...
Can you see if this helps you?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's not clear to me because I get the following result with getTimestamp : 1553695803464 How is it a date ?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, guess I should have mentioned that timstamp is in unix time. Add this to convert it from unix time.
Date date = new Date(messageExchange.getTimestamp() );
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanx It works 😄 And thx eveyrone for your help !
