Forum Discussion

harry's avatar
harry
Contributor
8 years ago

Is there a way to retrive context property value in other testcase

I was storing list in the context variable in the one of the testcase. But i want to read read/access the context value in another testcase.

2 Replies

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    Interesting question, can you share a little more of what you want to do? Is it that you have

     

    1 TestSuite

       TestCase 1

       TestCase 2

     

    And you want to pass an object variable e.g. a List (not String) between TestCase 1 and TestCase 2?

     

    As you may be aware, normal SoapUI properties are Strings, so cannot take a List. So, you'll have to store the List object somewhere else that can be shared between the two TestCases. Ideas that spring to mind:

    1) Use Groovy script to store the shared data in a quick in memory database - would work, but maybe a bit heavy for your needs

    2) Create a Class in a Groovy TestStep and store your list in a static property - does this make sense to you? A heavier version of this can be seem here (think you can maybe get away with defining/creating the class in a script) - http://rupertanderson.com/blog/1-how-to-develop-add-and-use-a-custom-groovy-library-in-soapui/

    3) Can't quite remember, but I think the Call TestCase TestStep might be able to pass context stuff to another TestCase? You'd have to check this actually works.

     

    Does any of this sound like what you need?

     

    Regards,

    Rupert

    • harry's avatar
      harry
      Contributor

      I have TestSuite1( tc1) which internally calls the TestSuite2(tc1).  using TestSuite1( tc1) i  need to read the context variables data( saved in the hash map) in the  TestSuite2(tc1).So, i had store the hashmap in the context variable in the TestSuite2(tc1).Now i want to retriew  that context variable data in TestSuite1( tc1)