Bind a Test to an External Data Source
Now that you have added a data source definition to your test project, you are ready to bind your test to that data source.
Standalone version - select the test you want to bind to the data source and click Bind Test in the Data Sources ribbon.
VS plugin - click the database icon. It should say none next to it (unless this test was previously data bound).
The Bind test to data source dialog opens:
Click the Select DataSource drop-down and choose the data source you just defined in the previous section. If your source is an Excel spreadsheet, choose which sheet from the spreadsheet to use. Once you select a sheet, the data from that sheet will be read and displayed in the dialog.
Note: You must have Excel installed on this machine for this to work.
Note how the first row of the spreadsheet is used as the column names.
To limit which rows from the data source to use, check the Filter data between rows box under the Configure section.
- If left unchecked, all data rows will be used during the test run.
- To limit which rows to use, check that box and select which rows you want to use by clicking the numeric up/down counters, and then Update to apply changes.
If your source is a SQL database, you have the option of using T-SQL to select the data you want. Using T-SQL, you can get as complex as you need in your SQL select statement. For example:
After entering your select statement, click Update to test and display the selected data in the Preview Data table.
Click OK to bind this data source to your test.
Remove Data Binding
To remove the external data source associated with a test, right click that test on the Project tab and select Remove Data Binding.