Forum Discussion

langph's avatar
langph
New Contributor
7 years ago

Groovy code to change a authorization profile in a rest service

Soapui 5.4.0

 

I am trying to change the authorization profile in a rest service test step with a groovy script, as i want to use the same test step in several environments. I can retrieve the current profile with testRunner.testCase.getTestStepByName("name").testRequest.getSelectedAuthprofile(). I I want to set it with setSelectedAuthProfile("Test")  - profile "Test" exists - I get an error.  How can I set this?

  • Ok, looked in the soapui code and tried the pro version. In the pro version it works, in the open source version thesetSelectedAuthProfile() method is private for some reason. But if you use setSelectedAuthProfileAndAuthType("Name",null), it does the same.

  • langph's avatar
    langph
    New Contributor

    Ok, looked in the soapui code and tried the pro version. In the pro version it works, in the open source version thesetSelectedAuthProfile() method is private for some reason. But if you use setSelectedAuthProfileAndAuthType("Name",null), it does the same.