Forum Discussion
nmrao
Champion Level 3
Can you show the script from "access toke retrieve"?
ranjit96
8 years agoContributor
Hi,
Can you please guide me about Property expansion for transferring this access_token ?
- kondasamy8 years agoRegular Contributor
I'm taking your code as a start,
def responseHeader=teststep.testRequest.response.contentAsString def slurper = new JsonSlurper() def json = slurper.parseText responseHeader def token=json.access_token testRunner.testCase.testSuite.testCases["login and update"].setPropertyValue("access_token",token)
You are setting the test case level property here called "access_token". You can use the property expansion as ${#TestCase#access_token}. This will work only within the test case. The property expansion has to be modified if you need to access from a different test cases.
I would recommend to set it as a project level property, the scope is large. Here is the reference - https://www.soapui.org/scripting---properties/property-expansion.html
Thanks,
Kondasamy