Forum Discussion
SmartBear_Suppo
SmartBear Alumni (Retired)
Hello,
The easiest way to manage your endpoint via a Groovy script is probably by creating a TestCase Test Property for it and using a Property Expansion. For example, create a new Test Property in the TestCase named "endpoint" and set the actual endpoint of the request to ${#TestCase#endpoint} (if you will be using the same endpoint for other testcases you may wish to make it a property on TestSuite level or even Project level instead). To change this property in a Groovy TestStep use:
Regards,
Dain
eviware.com
The easiest way to manage your endpoint via a Groovy script is probably by creating a TestCase Test Property for it and using a Property Expansion. For example, create a new Test Property in the TestCase named "endpoint" and set the actual endpoint of the request to ${#TestCase#endpoint} (if you will be using the same endpoint for other testcases you may wish to make it a property on TestSuite level or even Project level instead). To change this property in a Groovy TestStep use:
testRunner.testCase.properties['endpoint'].setValue('new endpoint')
Regards,
Dain
eviware.com
PramodYadav
7 years agoContributor
SmartBear_Suppo Wonder why no one gave Kudos to this reply yet. Here it goes :). Kudos !
As an additional note. if you want to use the endpoint url from a parameter defined at say TestSuite level, just change the TestCase to TestSuite in the endpoint url space. Something like this:
${#TestSuite#sGetTxsEndPointUrl}
Where, GetTxsEndPointUrl is a custom property i created at TestSuite level. If all your requests now have this formula at end point Url, there is no need to set, reset urls at test step level. Hope this helps to others.
Cheers, Pramod
Related Content
- 5 years ago
- 4 years ago
Recent Discussions
- 15 years ago