[Urgent] How to generate an report in SoapUI 5.7.0 (Free) with refresh access token?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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());
