This is a migrated thread and some comments may be shown as answers.

Set local data before test?

1 Answer 34 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 28 Oct 2019, 08:01 PM

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|

1 Answer, 1 is accepted

Sort by
0
Plamen Mitrev
Telerik team
answered on 29 Oct 2019, 12:12 PM

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!
Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Answers by
Plamen Mitrev
Telerik team
Share this question
or