How to get RestRequest's Endpoint URL from Project Custom Property?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to get RestRequest's Endpoint URL from Project Custom Property?
Hi,
I would like to extract the Endpoint of a rest request from an the project's CustomProperties/Excel file. Because my Endpoint is dynamic.
Thanks for your help in advance.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using a Groovy Script test step, enter the following:
def a = testRunner.testCase.getTestStepByName("Test Request - Example").getHttpRequest().getEndpoint()
log.info a
testRunner.testCase.setPropertyValue( "Endpoint", a )
You'll want to change the example request in my code to match your own.
This will result in custom Test Case property you can then write out via a DataSink test step.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi SmartBearAmber,
Thanks for your reply. May be i'm not asking the question properly. I am able to set the Endpoint of the request using the code you have provided. But I have 200 TCs that uses the same request. If i use your approach then I will have manually go in and add the groovy step in all 200 TCs. I want to be able to do it once. Please see image below:
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
