Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
15 years ago

obtaining GET value from the Raw View tab REST step

Hello,
I have a REST test step and looking at the RAW view, I can see

GET http://perf-g.ceidd.net/midgard/6degree ... ece03efbc6 HTTP/1.1
Connection: close
Accept-Encoding: gzip,deflate
session: v4q0jQABkMa_DgErMbH7BW1pZGdhcmQgwEsHgXJ9XV0NEagOmT9WjkFA526zjuVE
User-Agent: Jakarta Commons-HttpClient/3.1
Host: perf-g.ceidd.net

How can I capture the GET value 'http://perf-g.ceidd.net/midgard/6degrees/v1/search/suggest/cps;q=CS?TransactionID=165e3b83-0397-4807-a4d9-21ece03efbc6' via some groovy script.

Thanks

Ali
  • Hello,

    Wouldn't this GET parameter be visible as a Property in the Request tab? You should be able to access this in Groovy using a simple Property Expansion:


    context.expand('${RequestName#TransactionID}')


    Regards,
    Dain
    eviware.com
  • Hello,

    The easiest way to get this is by using a Groovy Assertion attached to the request itself. In it, simply use: messageExchange.endpoint

    If you want to save this property for later, you can create a Properties TestStep and store it there:


    context.testCase.testSteps['Properties'].setPropertyValue('url', messageExchange.endpoint)


    Regards,
    Dain
    eviware.com