cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass the o/p value of groovy script to another API as input

Highlighted
Occasional Contributor

How to pass the o/p value of groovy script to another API as input

Hi All,

 

Need a small help in fetching the value.

i am fetching the value required using groovy. Now i need to pass the output value of groovy script as input to the other API. I have tried in the below way:- Project->test suite-> test case -> selected the groovy script -> result -> i am not to fetch the value which it has displayed in the "log output". Unable to fetch the actual result. It would be great-full if you can provide the solution.

 

Even i have tried with property transfer. In that i am getting the null value.

Can any one please provide the solution to overcome this.

 

Regards,

Sankar

3 REPLIES 3
Highlighted
Community Hero

Re: How to pass the o/p value of groovy script to another API as input

If you need to store the result produced by a groovy script, I find the best way is to store it as a property.

 

Example: To store it in a Properties test step in the same test case:

context.testCase.testSteps["Properties Test Step Name"].setPropertyValue("PropertyName", "PropertyValue");

You can expand upon this to store it at the test case, test suite, or project level as well. Hope that helps!




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
Highlighted
Occasional Contributor

Re: How to pass the o/p value of groovy script to another API as input

Value is not getting set

Highlighted
Community Hero

Re: How to pass the o/p value of groovy script to another API as input

@SankarB, show your script which is causing the issue. Also show your request where the value needs to be set.


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors