Forum Discussion
PramodYadav
8 years agoContributor
We had the same problem statement. Here is the answer to the problem (curtsy user daggett).
Below is the summary of answer from him.
First groovy script:
def array = ['Kyiv', 'Boryspil', 'Kharkiv', "L'Viv", "Odesa"]context.setProperty('cities', array)log.info( 'script1: '+array )
Second groovy script:
def array = context.getProperty('cities')log.info( 'script2: '+array ) assert array.size()>0
[daggert] : Note
If you run just one step, then there will be absolutely independent context.
But if you run the whole testcase then there will be context shared for the whole testcase.
You can use Run from here context menu in your test case window to run from exact step.
P.S: Above note is the key that we were missing.
Open your script log in test case to verify that you indeed get the right values as mentioned in above two groovy scripts.
groovyguy
8 years agoCommunity Hero
While posting solutions and helping is great, usually reviving a thread that's this old isn't a good idea.