cancel
Showing results for 
Search instead for 
Did you mean: 

Get the current endpoint programmatically

Highlighted
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
Highlighted
Super Contributor

Hi Peter,

try

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

to get the endpoint.

regards!

/Ole
eviware.com
Highlighted
Occasional Contributor

Thanks Ole, it worked a charm!!
Highlighted
Contributor

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

Hi!

the above example is for a Groovy Script TestStep.

regards,

/Ole
eviare.com
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors