Forum Discussion

JHoreczky's avatar
JHoreczky
Contributor
14 years ago

Data driven arrays input

Hello Support Team,

I was searching the existing postings about a common situation, when the input data (request) contains a list or array of values. My question is how to populate the request from a spreadsheet based data source? Is there an out of the box solution for this common situation, or it would require some more work, like groovy scripting?

Thanks,
Joseph H.

3 Replies

  • Hi Joseph,

    currently it would require some scripting; you can loop the DataSource from a script with

    def dataSourceTestStep = testRunner.testCase.testSteps["..."]

    while( dataSourceTestStep.next( testRunner, context ))
    {
    ...
    }

    and build your XML this way to insert it into a following request...

    Hope this helps!

    regards,

    /Ole
    SmartBear Software
  • Hello Support team,

    Thanks for the update! Is there a tutorial available that shows an end-to-end example of using groovy in SoapUI? I am looking for example that does the following in a data driven scenario.

    Start condition: The SoapUI test case is configured to be data driven, using a spreadsheet that has on each row both the request input data elements, and the response output data elements - this latter for validation through assertions.

    On run a Groovy script should be able to correlate the response that was received with the proper row in the spreadsheet. Thus, fetching the response data elements from the spreadsheet from the row that corresponds with the currently returned XML response and compare it with the response. Basically doing custom validation / assertion as the default assertion functionality in SoapUI is not entirely meeting our requirements for cross fields validation and calculations based on the response.

    Thanks,

    Joseph H.
  • Hi Joseph,

    There is no complete example available for this, but the script I outlined above should give you the foundation for this. Create a DataSource pointing at your Excel/JDBC/etc data containing the required in/out data - set up the script to loop the DataSource as shown above and run corresponding Test Requests.

    Good Luck!

    /Ole
    SmartBear Software