Forum Discussion

DMcCabe's avatar
DMcCabe
Contributor
13 years ago

[Resolved] Using SOAPUI to verify a URL exists

I am using soapui to test a rest api. One of the features of the api is to upload an image. The response to that call includes a url to the uploaded image. I want to check that that url exists etc.
How can I send a http request to check that the url exists in soapui or groovy script?
  • Hi!

    If I understand you correctly, you want to call the URL provided in the response to make sure it's working.
    Then I suggest that you solve this by using a property expansion in the HTTP TestStep Endpoint that contains an XPath to the URL in the Response property of the first calling TestStep.

    The easiest way to create this property expansion is to use the Get Data.. right click menu somewhere where it's available, such as in a Groovy Script TestCase editor and then just navigate to the URL parameter.

    Hope this helps!

    --
    Regards

    Erik
    SmartBear Sweden
  • Erik

    Ok so I can access the url from the response within a groovy script with something like this:

    def response = context.expand( '${REST Acquire Request#Response#//WebApiServlet.Response[1]/result[1]/cdnUrl[1]}' )
    log.info("CDN URL is: ${response}")

    Which I think is what you are suggesting. The log.info statement confirms that I am getting the cdnURL from the response that I am looking for.

    So how do I send a request to that url now to check that it exists?

    Thanks for your help
  • Hi again!

    Just add ${REST Acquire Request#Response#//WebApiServlet.Response[1]/result[1]/cdnUrl[1]} as a new endpoint on a new HTTP TestStep.

    --
    Regards

    Erik
    SmartBear Sweden