Ask a Question

Get request and response size in groovy

Heidi_Bastemeij
New Contributor

Get request and response size in groovy

Hi,

I would like to get the response size and the request size in groovy (assertion!).
I have searched trough forum and trough internet, but i only see max size mentioned.

I would like to just get the size of the reponse and the request (plus or minus the http headers if possible) size.

Kind regards.
4 REPLIES 4
M_McDonald
Super Contributor

In the Script assertion you can use the messageExchange object to get the content without the headers:

[tt:jh5o3b8v]messageExchange.requestContent.size()

messageExchange.responseContent.size()[/tt:jh5o3b8v]
"Ignorance more frequently begets confidence than does knowledge"
Heidi_Bastemeij
New Contributor

Thanks!

Is there alsoa way to get the size with http headers?
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi,

you can get request and response size in number of bytes with

messageExchange.rawRequestData.length
messageExchange.rawResponseData.length

Hope this helps

Nebojsa
eviware.com

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

What if we want the size in Groovy not in script assertion

 

Size of request and not response.

 

Size of Response we can get through this statement

testRunner.testCase.testSteps[Step].testRequest.response.responseSize 

 

How about size of request without using messageExhchange ?

cancel
Showing results for 
Search instead for 
Did you mean: