Forum Discussion
Hi,
REST requests have quite a fixed format as I am sure you're aware.
To set the enpoint property, its quite easy using a property expansion e.g.
GroovyTestStep (before REST Request TestStep)
context["host"]="localhost"
then in the REST Request TestStep you can get use the value of the host variable to set all or part of the endpoint e.g.
http://${host}:7070
If you mean how to set the resource, I'm sure this is possible by somehow updating the object model of the TestStep, but I find it easier in these situations to instead use an HTTP Request TestsStep, where you are able to control the full URL by using a property expansion like above e.g.
In the Request URL property put something like http://localhost:7070/${context} or simply set the whole url using a property expansion set in a previous TestStep.
Hope this helps,
Cheers,
Rup
Hi,
Thanks for responding. I parameterized the resource url using Project level properties and I am able to successfully construct the dynamically URL. Thanks
- rupert_anderson10 years agoValued Contributor
Hi,
Ok, no problem.
Glad to have helped,
Cheers,
Rupert
- ktmrock7 years agoOccasional Contributor
Can you please provide an example how you changed the Resource url using groovy. I am struggling with the same issue. Instead of changing from the UI. I want to update it using groovy.
Related Content
Recent Discussions
- 15 years ago