Forum Discussion

ranjit96's avatar
ranjit96
Contributor
9 years ago
Solved

How to retrieve response of Test Step from one TestCase to another TestCase with groovy script ?

 

 

    Here  I want to retrieve "mul" Teststep response  from "MulipleTestCase" and  want to use this response in " Divide TestCase".

 

   def groovyUtils= new com.eviware.soapui.support.GroovyUtils(context)
  def teststep=context.testCase.testSuite.getTestCaseAt(1).getTestStepByName("mul")

   def response=groovyUtils.getXmlHolder("mul#Response")

 

 But I got an exception error "Unexpected Element:CDATA.." 

 

 

 

 

  • Can you try something like below and see if that helps:

     

    def testCaseName = 'Multiple testcase'
    def testStepName = 'mul'
    def response = context.testCase.testSuite.testCases[testCaseName].testSteps[testStepName].testRequest.responseContent
    log.info response

1 Reply

  • nmrao's avatar
    nmrao
    Champion Level 3

    Can you try something like below and see if that helps:

     

    def testCaseName = 'Multiple testcase'
    def testStepName = 'mul'
    def response = context.testCase.testSuite.testCases[testCaseName].testSteps[testStepName].testRequest.responseContent
    log.info response