Forum Discussion

krogold's avatar
krogold
Regular Contributor
4 years ago
Solved

groovy - list parsing fails if it contains one element

Hello, I often use jsonslurper to parse lists returned by test steps, but I have a case where it fails. I have a testStep that is a call to an API, it returns a list of elements such as ["fim:devic...
  • Lucian's avatar
    7 years ago

    Hi,

     

    The groovy script for this is quite simple:

     

    // Identify test step
    def testCase = testRunner.testCase.testSuite.project.testSuites["Name of your test suite"].testCases["Name of your test case"]
    def testStep = testCase.testSteps["Name of your SOAP request"]
    
    // Run test step
    testStep.run( testRunner, context ) 
  • kishore530's avatar
    kishore530
    7 years ago

    Thanks a ton Lucian for your help.  Its working :-)

    Could you please help here again.
    is there any possibility to send input value for SOAP request from groovy script ?

     

    I am using below code snippet. but, facing errors.

    testStep.run( testRunner, context.x="5")      // i would need to send value 5 to soap request

     

    in soap request, using like this to ${x} in the request message.