Transfer object between test cases

Hi, I have a simple question. How can I transfer an object from my response, that is in my first test case to the request in the second test case?

Hi @mat2224v2

You can use WebUI.callTestCase to achieve this, specifically by returning the response object from the first test case, and then use it in the second test case .

Your main test case

ResponseObject rsp = WebUI.callTestCase(findTestCase('Id to the first test case'))

WebUI.callTestCase(findTestCase('Id to the second test case'), ['prev_rsp' : rsp]);

Sorry, but I am a very beginner.

My first test case is called “AddLocation”. I have this fragment inside it:

def res = prasowacz.parseText(AddLoc.getResponseBodyContent())
def val = res.place_id

I want to transfer my variable “val” to the second test case (GetLocation). How to use this in my case:

ResponseObject rsp = WebUI.callTestCase(findTestCase(‘Id to the first test case’))
WebUI.callTestCase(findTestCase(‘Id to the second test case’), [‘prev_rsp’ : rsp]);

I’ve solved my problem. You can close this topic :slight_smile:

1 Like