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

Topic applies Topic does not apply Topic does not apply Topic does not apply

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.

Note

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

  1. Create a new folder, and give it a name, for example Data.

    Note

    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.

  2. 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

  1. Open a Web performance test.

  2. In the Web Performance Test Editor, click Add Data Source.

    The Connection Properties dialog box is displayed.

  3. In the OLE DB Provider drop-down list, select Microsoft Jet 4.0 OLE DB Provider.

  4. In the Server or file name text box, type the name of the folder that contains your text file.

    Warning

    Specify the name of the folder, not the file itself.

  5. Choose Advanced.

    The Advanced Properties dialog box is displayed.

  6. Locate the Extended Properties property, and type Text.

    Note

    If your text file does not contain a header row with column names, type Text;HDR=NO; instead of Text.

  7. Click OK to close the Advanced Properties dialog box.

  8. (Optional) Click the Test Connection button to verify your connection to the file.

  9. Click OK to close the Connection Properties dialog box.

  10. The Choose Tables dialog box is displayed.

  11. In the Choose Tables dialog box, select the name of the text file that you want to use.

    Note

    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.

  12. 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

  1. Open a Web performance test to which you have added a text file as a data source.

  2. Find a request in the request tree that requires data, for example a request with a Form Post parameter. Select the parameter node.

  3. 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.

  4. On the Test menu point to Edit Test Run Configurations, and then click Local Test Run.

  5. 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.

  6. Click Apply and then click Close.

  7. On the File menu click Save to save the Web performance test.

See Also

Tasks

How to: Add Data Binding to a Web Request

How to: Add a Schema Definition to a Text File Data Source for a Web Performance Test

Walkthrough: Adding Data Binding to a Web Performance Test

Concepts

Binding a Data Source to a Web Performance Test