Ask a Question

How to get RestRequest's Endpoint URL from Project Custom Property?

Rookie
Occasional Contributor

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.

3 REPLIES 3

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.

Amber
Rookie
Occasional Contributor

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: 2016-09-02_14-57-36.jpg

Rookie
Occasional Contributor

 
cancel
Showing results for 
Search instead for 
Did you mean: