Set local data before test?

2 posts, 0 answers
  1. David
    David avatar
    19 posts
    Member since:
    Jun 2019

    Posted 28 Oct Link to this post

    If I have a coded sql query I want to run before a test and also use the returned values (ID and Company) to "dynamically" set the local data so that the test will run multiple iterations against the values

     

    | ID | Company |

    |1 | Disney|

    |2| Google|

    |3| Facebook|

  2. Plamen Mitrev
    Admin
    Plamen Mitrev avatar
    157 posts

    Posted 29 Oct Link to this post

    Hi David,

    You can achieve this in code and with some small test adjustments. I created a sample Test Studio project and you can find more details on the necessary steps below.

    1. Create a test and add empty local data table with the required columns and rows. You can rename the columns (see emptyLocalData.png).
    2. Record the necessary steps and data bind the ones you need. I did it for step 5 in the sample test.
    3. Add assembly reference to your project for System.Xml.dll.
    4. Add a coded step to set the results from SQL query to a collection. You need to declare the collection as static in the test's class, which will hold the results from the SQL query. In my example I used a List<string> to create a simple scenario.
    5. Add another coded step before you use the local data in your test. Here is when you need to overwrite the empty local data values with the ones from the static collection. Please check the sample code in step 4 for more details.

    I hope this help you with the scenario at hand. If you need further assistance, please share more details about the test and code you currently have.

    Regards,
    Plamen Mitrev
    Progress Telerik

     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top