Forum Discussion

PeterT's avatar
PeterT
Occasional Contributor
17 years ago

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

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Peter,

    try

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

    to get the endpoint.

    regards!

    /Ole
    eviware.com
  • I'm fairly new to this environment.  Exactly where do you place this code snippet?
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    the above example is for a Groovy Script TestStep.

    regards,

    /Ole
    eviare.com