Forum Discussion

doubtsreadyapi's avatar
doubtsreadyapi
Contributor
5 years ago

How to download a file from ReadyAPi using groovy script

Hi 

 

Is there a way from Ready APi to download a file using groovy script, and place it in my local directory?

ie., when i hit a URL the excel file download automatically when it get downloads it must  get stored into my local directory path. and to download the file authorization is required, so how to pass the authorization?

 

Thanks in Advance.

  • nmrao's avatar
    nmrao
    5 years ago
    Was there any issue to just follow what was mentioned in the earlier reply?
    Isn't url forming incorrect by just looking at it?

    http://( '${#TestCase#TEST URL}' ) -> change it to ${#TestCase#TEST URL}
      • nmrao's avatar
        nmrao
        Champion Level 3
        Use property expansion for url of the HTTP Request.
        That means, the value for the URL has to be assigned in the previous test step
        Say use a test case level custom property FILE_DOWNLOAD_URL and assign the value for before executing HTTP Request.
        In the URL for HTTP Request, assign value "${#TestCase#FILE_DOWNLOAD_URL}"

        Here is the documentation for Property expansion
        https://www.soapui.org/scripting-properties/property-expansion/