Forum Discussion
- JHuntCommunity Hero
If you don't use return, a groovy script returns the last thing it evaluated. In your case it's the info() method on Logger, which returned void.
If you want to keep your log statement, just get your script to
return a
- shriya12Occasional Contributor
I have added it but not working, only when individually I will run the script I am getting the result. I need to pass the script result in next test step.
Please find the attached test case and the details for groovy script.
- JHuntCommunity Hero
Instead of returning a, try putting it into the context.
context.a = a
then in your request body:
${a} or ${=context.a}
- ravirajOccasional Contributor
Remove your 3rd line [log.info a] from your code and then execute your application
you should get the result.regards,
Raviraj.
- shriya12Occasional Contributor
I have deleted it but not working, only when individually I will run the script I am getting the result. I need to pass the script result in next test step.
Please find the attached test case and the details for groovy script.
- ravirajOccasional Contributor
Hi,
So in your next request [REST Request] add the following code
${Copy of code_trim#result}
in post payload section - and in Response view it in Outline tab.
Regards,
Raviraj.
- shriya12Occasional Contributor
I have added code to save the output in a file and getting data from the file. I am getting success response now.
Thank you for your help.