Binding a Data Source to a Web Performance Test

You can use data binding in a Web performance test to provide the input to HTTP requests in the Web performance test. For example, you could provide a list of logon names and logon passwords that would be used during the execution of the Web performance test to try repeated logons.

You can examine your Web performance tests and decide which part of a test you want to be data-driven. Then you can create a data source for that part of the test. You can bind data in several locations in a Web performance test.

Data Binding Details

By using data binding, a database can provide data for a Web performance 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, and 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 Performance 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
    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 Performance Test

  • QueryString Parameters
    Bind to data in a database for any name and value pairs used in your Web performance tests.

  • Form Field Parameters
    Bind to data in a database for any input field that appears on a Web form.

  • Request URL
    Bind the request URL to data in a database file.

Access Methods

Visual Studio Ultimate 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 good load testing because it more realistically models real world activity and helps make sure that server caches, and so on, are being used effectively.

When your Web performance tests are assembled in a load test and run on a remote machine, 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. For more information, see Distributing Load Tests Across Multiple Test Machines Using Test Controllers and Test 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 database 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 lets you reuse this data in other Web performance tests, share this data with other testers, and use this data in a load test on a remote machine more easily.

Tasks

Tasks

Associated Topics

Adding a data source to a Web performance test: Add a data source to a Web performance test so that you can bind HTTP requests to it. The data source can be from a database, an XML file, or a comma separated value file (CSV). You can also provide a schema definition which describes a text file data source, such as a CSV file without column headers.

Binding a data source to a Web request: After you have added a data source to your Web request, you can bind a Web performance test request to the data source in the Web performance test.

Binding a data source to a Web service request: You can bind a Web service request to a data source.

NoteNote
To bind a data source to a Web service requests, you must edit the SOAP body in your XML code manually.

Configure how many times you want the Web performance test to access data in a Web performance test: Configure how many times you want a Web performance test to access the data in a data source.

See Also

Tasks

How to: Add Data Binding to a Web Request

How to: Set Credentials on a Web Performance Test

Other Resources

Customizing Web Performance Test Recordings Using Web Performance Test Editor

Creating and Editing Web Performance Tests

Distributing Load Tests Across Multiple Test Machines Using Test Controllers and Test Agents