Ask a Question

[Urgent] How to generate an report in SoapUI 5.7.0 (Free) with refresh access token?

baqri14
New Contributor

[Urgent] How to generate an report in SoapUI 5.7.0 (Free) with refresh access token?

 
1 REPLY 1
baqri14
New 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());

 

cancel
Showing results for 
Search instead for 
Did you mean: