Ask a Question

How to use 1 groovy script value to another groovy script

ankushpoly13
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
richie
Community Hero

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 Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
HimanshuTayal
Community Hero

@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,
Remember to give "Kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
Olga_T
SmartBear Alumni (Retired)

@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

nmrao
Champion Level 3

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.
groovyguy
Champion Level 0

@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!
TanyaYatskovska
SmartBear Alumni (Retired)

Community, thanks for your assistance!

 

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

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



cancel
Showing results for 
Search instead for 
Did you mean: