TopicObserver.com

Trond Pettersen on Web Development and Topic Maps

Tag: webtest

Canoo WebTest: Get Request URL & Refresh Page

The other day I needed to “re-invoke”/refresh the current page – i.e. the response HTML – during a <webtest />.

Since neither the manual nor a couple of quick Google searches gave me what I needed, here’s how I solved the problem using a simple <scriptStep> followed by an <invoke>:

<scriptStep description="Get the current HTTP Request URL." language="groovy">
def url = step.getContext()
              .getCurrentResponse()
              .getWebResponse()
              .getRequestSettings()
              .getUrl()
              .toExternalForm();
step.setWebtestProperty('tmp.currentRequestUrl', url, step.PROPERTY_TYPE_DYNAMIC);
</scriptStep>
<!-- now you can use it like this or pass it to a definition -->
<invoke url="#{tmp.currentRequestUrl}" />

In case it might be of use to you…

  • RSS @twitter

    • Invalid Twitter Response.
  • Tags

  • Topics

  • Recent Comments

  • Topic Map Feeds