Forum Discussion
1 Reply
- baqri14New Contributor
I have found the solution.
This can be solved with the help of the Groovy script.
// Import the required classes
import com.eviware.soapui.impl.rest.actions.oauth.*;
import com.eviware.soapui.model.support.ModelSupport;// Set up variablesdef authContainer = testRunner.testCase.testSuite.project.OAuth2ProfileContainer
def authProfile = authContainer.getProfileByName("Profile 2")
def oldToken = authProfile.getAccessToken();// Create a facade object
def oAuthFacade = new OltuOAuth2ClientFacade();// Request an access token in headless mode
oAuthFacade.requestAccessToken(authProfile);// Wait until the access token gets updated
while(oldToken == authProfile.getAccessToken()) {
}// Post the info to the log
log.info("Set new token: " + authProfile.getAccessToken());
Related Content
- 2 years ago
- 3 years ago
- 4 years ago
Recent Discussions
- 3 days ago