About Data Binding in Web Tests
By using data binding, a database can provide data for a Web Test. You can bind data from a data source to a part of a Web request that requires data, such as a Form Post Parameter. You can bind to data in a database by clicking Add Data Source.
Additionally, an OLE DB data source can be used for data binding, including .csv files, XML documents, Excel, Access and SQL Server databases.
You can also use data binding in the following ways:
For the properties that you can edit in the Web Test Editor.
In validation and extraction rules and in Web service requests.
In the properties for test and request-level plug-ins.
To use data binding for plug-ins and rules, you must manually enter the data-binding syntax: {{<context-variable-name}}. Data sources place items in the context with the format dataSourceName.TableName.ColumnName. This means that a binding could resemble the following: {{ds1.myTable.myColumn}}
Properties that Use Data Binding
Set Credentials
You can bind to data in a database to set the credentials on a test. For example, you can have a list of logon names and passwords that you use in your tests.For more information, see How to: Set Credentials on a Web Test
QueryString Parameters
You can bind to data in a database for any name and value pairs used in your Web tests.Form Field Parameters
You can bind to data in a database for any input field that appears on a Web form.Request URL
You can bind the request URL to data in a database file.
Access Methods
Visual Studio Team System Test Edition supports sequential access, random, and unique access of records in the database when binding to a data source.
Sequential
Starts at the first record and moves through a table row by row. This is the default. This access method will loop through data in a table throughout the duration of a test.Random
Move randomly through the rows in a table. This access method will loop through data in a table throughout the duration of a test.Unique
Move sequentially through the data, row-by-row, but only one time for each record. It will not loop.
Considerations for Load Testing
Execution of data driven tests is an important aspect of proper load testing because it more realistically models real world activity and helps ensure that server caches, and so on, are being used effectively.
When your Web tests are assembled in a load test and run on a remote rig, you must consider how the individual agent computers use the bound data. For example, when the access method is sequential or random, each agent gets a complete copy of the data that is shared by all virtual users created on that agent. However, when the access method is unique, the data is divided among the agents.
You must also consider the location of the data source if you are using a text file as a data source. If you hard code a directory path, for example c:\datafolder, at design time, the text file will have to reside in c:\datafolder on each agent computer at run time. It is recommended that you create data sources on network shares. Creating data on network shares allows you to reuse this data in other Web tests, share this data with other testers, and use this data in a load test on a rig more easily.
Related Sections
See Also
Tasks
How to: Add Data Binding to a Web Request
How to: Set Credentials on a Web Test
Walkthrough: Adding Data Binding to a Web Test