How do I get writable datasource values in an array

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in SOAtest

For one of my tests, I wanted to get values from datasource into an array for verification of extracted values from my response traffic.

Here is what I want to do:
- Using DB tool & XML databank, am extracting DB values and storing them in writable datasource.
- In a method A, I am extracting parameters from response traffic and storing them in an array B.
- in same method A, I want to verify that my extracted values from response traffic are available in database table that I have stored in writable datatable
- For that I want to store values from writable datatable into an array in method A so that I can loop both arrays and verify values

When I do this:
Val = []
Val = context.getValue("writable", "TST1"))

I am only getting 1 value in the array when the datasource has more than 500 rows for column TST1.



  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    edited December 2016
    I've attached an example of how you can store the values to some type of data structure that you can iterate over the values with. I'm more familiar with Java than I am with python so for the sake of convenience I'm using a java.util.Vector instead of an array. But ultimately it'll have the same result.

    Here's what's done in my example; it iterates over every row of the writable data source and add it to a vector that i store in the application context. To iterate over all rows in the writable data source within a single test case before executing the next test case, it needs to be done in a Set-Up Test. Once it's done iterating over all writable data source rows it moves on to the standard tests. In the standard test, it access the vector by getting it from context again, and I can now iterate over the values stored in the vector and compare it with the array you've created.

    I created the example .tst file in 5.5.1 SP 4.0
  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    edited December 2016
    Great!!!! this worked very well. Thank you so much for your help.

Sign In or Register to comment.