Forum Discussion

fenwickr's avatar
fenwickr
Occasional Contributor
9 years ago
Solved

I have a groovy script in a test case how can I get a response from another test case to use

I have a Script in a test case that runs all my Test cases when it runs a Test step in another Test case I want to use the response 

I have tried a few things like using the test step name def Response1 = context.expand('${QueryMeet#Response}')

 

is there someway for me to do this.

 

Regards

Rikki

  • Hi, fenwickr!

     

    Yes, you can do this in Ready! API 1.4. You should choose "Get Data" option in context menu of Groovy editor and select your response. The output will be something like:

    def response = context.expand( '${#[TestSuite 1#TestCase 1#Request 1]#Response}' )

3 Replies

  • AntonE's avatar
    AntonE
    SmartBear Alumni (Retired)

    Hi, fenwickr!

     

    Yes, you can do this in Ready! API 1.4. You should choose "Get Data" option in context menu of Groovy editor and select your response. The output will be something like:

    def response = context.expand( '${#[TestSuite 1#TestCase 1#Request 1]#Response}' )
    • nmrao's avatar
      nmrao
      Champion Level 3
      AntonE, thank you for the solution.

      This is first time that I see the snippet which is showing to refer multiple levels (${#[TestSuite 1#TestCase 1#Request 1]#Response}).
      • AntonE's avatar
        AntonE
        SmartBear Alumni (Retired)

        nmrao, You're welcome.

        Yes, it's one of the new features we introduced in 1.4.