Forum Discussion
Thank you for your suggestion.
I used this property expansion ${#login and update#access_token}
But error is shown :
<message>Authorization has been denied for this request.</message>
It's not retrieved access_token value. Please suggest me.
- ranjit969 years agoContributor
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) - ranjit969 years agoContributor
Hi,
Can you please guide me about Property expansion for transferring this access_token ?
- kondasamy9 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
Related Content
- 5 years ago
- 6 years ago
- 2 years ago
- 9 years ago