Forum Discussion

teak's avatar
teak
Contributor
8 years ago

how to pass groovy context array to other testCases in testSuite

Hi, 

I have an array [list] in a groovy script [from the response of previous request]. 

How can I access this array from another testCase in the same testSuite? 

 

as far as I understand context is only available from within the testCase [I can access the array from other testSteps in the same testCase]

 

I was thinking of converting to string [toString] and storing it as a property. 

Then getting the property in another testCase, converting the string back to an array and using it there. 

This seems a bit messy to me. 

 

Thanks

6 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    In general practise it is adivsed to have each test independent.

    Not sure what your case is and having dependency between the tests.
    • teak's avatar
      teak
      Contributor

      Hi rao, 

      thanks for your reply. 

      I am not using the testCases as such and I am having testCases that rely on other testCases. 

      I have a suite of cases that run sequentially [some getting clients, tokens, etc to use in other test steps] 

      I suppose im just using the testCases as containers for test steps.

       

      My case here is I have a request in one testCase that returns an object of items which I want to use to compare to another array in another request later in different testCase. 

       

      I would like to avoid having all of the test steps in 1 testCase. 

       

      Thanks

      • teak's avatar
        teak
        Contributor

        does anybody know if this is possible or not?

        thanks