cancel
Showing results for 
Search instead for 
Did you mean: 

How to use 1 groovy script value to another groovy script

New Contributor

How to use 1 groovy script value to another groovy script

How to use 1 groovy script value to another groovy script ?

6 REPLIES 6
Community Hero

Re: How to use 1 groovy script value to another groovy script

Hi @ankushpoly13

That description of what you need is going to need a lot more detail before anyone is gonna be able to help out!

People are going to need to understand your use case, what your groovy scripts are doing etc.

If you need to pass a value from one script to another it could be fairly simple (depending on what your scripts are doing), but no one's going to be able to help until you provide a lot more info i'd expect!

Cheers,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the title of the post to something more descriptive? This will help people when searching for problems.
Community Leader

Re: How to use 1 groovy script value to another groovy script

@ankushpoly13 ,

 

There are several ways to use the value of one groovy script to another groovy but before answering i need to know what kind of value you need to use or transfer via one groovy to another.

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" Smiley Happy

Thanks and Regards,
Himanshu Tayal
Moderator

Re: How to use 1 groovy script value to another groovy script

@HimanshuTayal and @richie, thank you for looking into this!

 

@ankushpoly13, can you please send the information that Himanshu and Rich requested?


Olga Terentieva
SmartBear Assistant Community Manager

Community Hero

Re: How to use 1 groovy script value to another groovy script

Another basic thing.

Does it really require two groovy script test steps in first place? Can't the logic be done in single step where you don't land into problem itself?

If you can't avoid two steps, then save the value into custom property and access it in the other script.


Regards,
Rao.
Community Hero

Re: How to use 1 groovy script value to another groovy script

@nmrao brings up a good point and that's typically how I handle having to share results of a groovy script across tests. Store it as a property and use property expansion to reference it.




---

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

Re: How to use 1 groovy script value to another groovy script

Community, thanks for your assistance!

 

@ankushpoly13, please let us know if the question was answered.

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
Watch the New Interview
APITestingMistake#2
Top Kudoed Authors