Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Looking for a way to iterate each row in multiple datasources

Options
goofy78270
goofy78270 Posts: 133

I have 2 key tables, but could have more, and am looking to iterate through each row in each table independently but for a single request.

for example, table 1 has row 1 though 4 and table 2 has trows 1 though 12. I am trying to get 48 combinations, without coding all potential combinations in one table.

I tried an aggregate datasource, but it only iterates through the tables one, and stops after the rows in the smallest table are met.

This is to account for various combinations in path and query parameters such as:
http://somurl.com/{table1-columnA}/{table2-columnA}

Comments

  • goofy78270
    goofy78270 Posts: 133
    Options

    THOUGHTS...

    Would it be possible to create a setup test to loop through each datasource needed, and output all the possible combinations to a writeable database, then simply use the writeable database for test processing?

    I know it might add overhead, but unsure of another way at the moment.

    If this is possible, could you please provide samples for how to read values from a DS and then how to write them to a DS as well? I can nest the functionality to create all the combinations as needed.

    possible additions:

    • use column headers from writable DS to determine what columns from other datasources to concatenate (I believe these would have to be setup initially as test would use these headers for parameterizing variables)
    • limit readable rows from source DS(s) to only pull in a subset of tests
  • Thomas Moore
    Thomas Moore Posts: 82 admin
    Options

    Hi Goofy78270,

    This is possible to do, like you said with a bit of setup. Attached is a zipped .tst file that can replicate the behavior you are looking for.

    For reference, what this .tst file is doing is having two messaging clients set to None transport that will iterate through their individual data source rows, saving their values into an XML Databank.

    The third client in the test takes the combination of databanked values to send both in the request. The test will then loop through every permutation of data with 3 rows in the first DS and 7 in the second, meaning 21 permutations of row data.

    Feel free to post again if you have any questions! Hope this helps!