Forum Discussion

Heidi_Bastemeij's avatar
Heidi_Bastemeij
New Contributor
14 years ago

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

  • M_McDonald's avatar
    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]
  • SmartBear_Suppo's avatar
    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
    • gauravkhurana's avatar
      gauravkhurana
      Occasional Contributor

      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 ?