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 oAuthProfile = testRunner.testCase.getTestStepByName("Groovy Script").getSelectedAuthprofile()
def oAuthProfile = context.getCurrentStep().testCase.testSuite.project.getAuthRepository().getEntry(oAuthProfile)
Also am newbie, how do i figure out various classes and methods available in readyapi to use in groovy script
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.