cancel
Showing results for 
Search instead for 
Did you mean: 

Get the current endpoint programmatically

Occasional Contributor

Get the current endpoint programmatically

Hi there

Does anyone know how to get the current endpoint URL programmatically?  I have some scripts in a test case that are grabbing data from a database, if I modify the current endpoint for the requests in that test case obviously I also need to point to a different DB.  I can easily point to another DB if I know the current endpoint but am unsure how to grab the endpoint from the code.

Any help would be appreciated.

Cheers

Peter
4 REPLIES 4
Super Contributor

Re: Get the current endpoint programmatically

Hi Peter,

try

def ep = testRunner.testCase.testSteps["Request Step"].testRequest.endpoint

to get the endpoint.

regards!

/Ole
eviware.com
Occasional Contributor

Re: Get the current endpoint programmatically

Thanks Ole, it worked a charm!!
Contributor

Re: Get the current endpoint programmatically

I'm fairly new to this environment.  Exactly where do you place this code snippet?
Super Contributor

Re: Get the current endpoint programmatically

Hi!

the above example is for a Groovy Script TestStep.

regards,

/Ole
eviare.com