Forum Discussion

paceroza's avatar
paceroza
New Contributor
14 years ago

How to get response from step in another test case

Hi guys,
I need some values from response in another test case. The situation is like this:

TestSuite
TestCase1
Step11
Step12
TestCase2
Step21
Step22
Step23


from TestCase2 (in one of these steps) I'm trying to do this:

def response = context.expand( '${Project#TestCase1#Step11#Response//something}' )

Any suggestion is appreciated

Thanks

1 Reply

  • balak84's avatar
    balak84
    Occasional Contributor
    This should help:

    def utils = new com.eviware.soapui.support.GroovyUtils( context );
    def project = testRunner.testCase.testSuite.project ;
    def tc = project.testSuites["TestSuite"].testCases["TestCase_2"] //Can also pick value from a different Test Suite: if the test step in TS2 has run fine
    def httpRespHeaders = tc.testSteps["TestCase2_TestStep_Name"]
    .testRequest.response.responseHeaders;
    def tstep1 = tc.getTestStepByName("TestCase2_TestStep_Name");
    def response_other_TestCase = tstep1.getPropertyValue("Response");
    log.info response_other_TestCase
    return (response_other_TestCase)

    Hope it helps.

    Regards,
    Bala.