subhaD
7 years agoContributor
Oauth 2 - Script to fetch oauth profile name
I am trying to fetch the auth profile name that is selected for this environment at the test sutie level.
I am using below code, please help me debug the issue on first line
String oAuthP...
- 7 years ago
Hi subhaD
Instead of your second commented line, you can use this code snippet to get the name of the auth profile, which is applied to a needed service, within the current environment:
def env = context.testCase.testSuite.project.getActiveEnvironment() def restServ = env.getRestServiceAt(0); restServ.getEndpoint().getConfig().getAuthProfile()
Example:
About getting service by name rather than by index you can read here: https://smartbear-cc.force.com/portal/KbArticleViewer?name=How-to-work-with-Environments-in-Groovy-scripts&sp=all
I hope I understood your task correctly this time.