How to: Bind a Web Performance Test to a Text File
This topic applies to:
Visual Studio Ultimate
Visual Studio Premium
Visual Studio Professional
Visual Studio Express
Binding a Web performance test to a text file data source is similar to binding it to a database, but there are some additional steps required. Generally, the steps to bind a Web performance test to a text file include the following procedures:
Create a data source from a text file.
Add a text file as a data source to a Web performance test.
Bind a Web performance test to a text file data source.
The culture specific separator can be found in the registry setting HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Text\Format.
It is also possible to use more complicated text files by providing an optional schema definition file. For more information, see How to: Add a Schema Definition to a Text File Data Source for a Web Performance Test.
Creating a Data Source from a Text File
To create a data source from a text file, you must set up a folder to hold your text file. The folder will act as a database, and the text file will act as a table in the database. You can have more than one text file in your database folder.
To create a data source from a text file
Create a new folder, and give it a name, for example Data.
It is recommended that you create this folder on a network share. This will allow you to 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 that uses a test agent and a test controller more easily. For more information, see Binding a Data Source to a Web Performance Test.
Add your text file to the directory.
Adding a Text File as a Data Source to a Web Performance Test
Now that you have created a data source from your text file, you can add it to your Web performance test.
To add a text file as a data source to a Web performance test
Open a Web performance test.
In the Web Performance Test Editor, click Add Data Source.
The Connection Properties dialog box is displayed.
In the OLE DB Provider drop-down list, select Microsoft Jet 4.0 OLE DB Provider.
In the Server or file name text box, type the name of the folder that contains your text file.
Specify the name of the folder, not the file itself.
The Advanced Properties dialog box is displayed.
Locate the Extended Properties property, and type Text.
If your text file does not contain a header row with column names, type Text;HDR=NO; instead of Text.
Click OK to close the Advanced Properties dialog box.
(Optional) Click the Test Connection button to verify your connection to the file.
Click OK to close the Connection Properties dialog box.
The Choose Tables dialog box is displayed.
In the Choose Tables dialog box, select the name of the text file that you want to use.
If you have more than one text file in the data folder, you can select all the files that you want to use. Each file is treated as a table. The period (.) in the text file name will be replaced by a number sign symbol (#), for example, TestData#txt.
Click OK to close the Choose Tables dialog box.
A Data Sources node will be added to your Web performance test, and the text file will appear as a table in the hierarchy.
Binding a Web Performance Test to a Text File Data Source
Now that you have added your text file as a data source, you can bind a part of your Web performance test to it in the same way would to any other data source.
To bind a Web performance test to a text file data source
Open a Web performance test to which you have added a text file as a data source.
Find a request in the request tree that requires data, for example a request with a Form Post parameter. Select the parameter node.
In the Properties window, click the drop-down arrow in the Value property and select the correct DataSource in the hierarchy. Next, choose the name of your table and the name of the field to use as the value.
On the Test menu point to Edit Test Run Configurations, and then click Local Test Run.
In the localtestrun.testrunconfig dialog box, select Web performance test in the left pane, and then select the One run per data source row option in the right pane.
This causes the test to run iteratively, one time for each row in the database. On each test iteration, the pointer moves to the next row in the database.
Click Apply and then click Close.
On the File menu click Save to save the Web performance test.