Forum Discussion

tom_13's avatar
tom_13
Contributor
15 years ago

get property

Hi all,

I need to get HashMap from one groovy script to another. It is posible if save it into global property or result of script. But it can be saved only as a string. Then I need parse string to create a map from it.

Is the posibility get property (variable) without converting it to string, get in type as it is?

1 Reply

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello,

    It depends on where your scripts are. If they are used in the same invocation, for example they are two TestSteps in the same TestCase and you run the entire TestCase, then you can store the map in the context.


    //First script
    var hashMap = ...

    context.myvar = hashMap


    //Second script
    def hashMap = context.myvar



    Note that this only works so long as the context is the same for both scripts!

    Regards,
    Dain
    eviware.com