Forum Discussion

Luxoft_Internat's avatar
Luxoft_Internat
Contributor
14 years ago

How implement non-static object accessible from diff-t t ste

Hi,

Is there any way to make the groovy script object accessible from the different test steps other than make it "static"?

Thanks

1 Reply

  • Hello,

    Depends on how long you need to persist the Object. If it is during a single run (TestCase, or TestSuite, depending on what you're running) you can place it in the run context:


    def someObject = //Initialize the object here...
    context['my_global_object'] = someObject

    //... later, in a different TestStep/Script:

    def someObject = context['my_global_object']

    //Do something with someObject


    Regards,
    Dain
    SmartBear Software