Forum Discussion
Hi Harold,
You can start with the following articles:
How to change credentials for OAuth authorization profiles using Groovy?
How to change credentials for an auth profile using Groovy script?
And refer to the documentation: http://www.soapui.org/apidocs/overview-summary.html
- HaroldR8 years agoContributor
Hey Nastya_Khovrina
Thanks for providing some documentation related to authentication. Finally, I solve my problem thanks to this script :import com.eviware.soapui.config.AuthEntryTypeConfig; def project = testRunner.getTestCase().getTestSuite().getProject(); def authProfile = project.getAuthRepository().createEntry(AuthEntryTypeConfig.BASIC, "User1212165"); authProfile.setUsername("Username"); authProfile.setPassword("Password"); //authProfile.setDomain("NewDomain"); authProfile.setPreemptive(false); //def request= testRunner.testCase.getTestStepByName("Name of the Step").getHttpRequest(); //request.setSelectedAuthProfile("Name of your profile");
It permit me to add several profiles in Auth Manager window.
RegardsHR
- dhruth7 years agoVisitor
Hi, I tried this for SoapUI 5.4 opensource, but not working? Any idea how to achieve the same for open source.
def step = testRunner.testCase.getTestStepByName("Name of the Step").getHttpRequest();
step.setSelectedAuthProfile("Name of your OAuth profile");Getting error stating "setSelectedAuthProfile" no method found,
- Nastya_Khovrina7 years agoSmartBear Alumni (Retired)
Hi dhruth,
I'm not sure whether it is available in Open Source.
- HaroldR8 years agoContributor
Nastya_Khovrina,
Any idea of how could I set the authentication profile just created before at :1 - Project level
2 - TestSuite level
And at the same time apply the selected authentication profile to all of its childrens
See image for further informations
Regards
Harold- Nastya_Khovrina8 years agoSmartBear Alumni (Retired)
Hi Harold,
To set the authorization profile for a project and for a testSuite, you can use the setAuthProfile method:
import com.eviware.soapui.config.AuthEntryTypeConfig; def project = context.getTestCase().getTestSuite().getProject(); project.setAuthProfile("Name of your Profile"); def ts = project.getTestSuiteByName("TestSuite Name"); ts.setAuthProfile("Name of your Profile");
To set the "Inherit from parent" value for a child, you can use this script:
def testCase = project.getTestSuiteByName("TestSuite Name").getTestCaseByName("TestCase Name); testCase.setAuthProfile("Inherit from parent");
But, child elements should have this value by default.
Documentation:
Class WsdlProjectPro: https://www.soapui.org/apidocs/pro/com/eviware/soapui/impl/wsdl/WsdlProjectPro.html
- HaroldR8 years agoContributor
Hi Nastya,
Your message is really helpful, thanks you!!!
Also , I was wondering :
Regarding the code you provided in the first frame, if I am about to use the method to set the authentication at the project level, will all childs descending nodes inherit from the authentication profile. In other words, will the inherit from parent method be spread to all containing nodes whithout using the code of the second frame?
Is it the same behaviour if we decide to set the authentication at testsuite level?
Regards,
Harold
Related Content
- 10 months ago
- 10 months ago
Recent Discussions
- 18 days ago