How to: Add a Schema Definition to a Text File Data Source

You can bind a Web test to a text file data source. The procedures for binding to simple delimited text files, such as comma separated value (csv) files, are similar to binding to databases. For more information, see How to: Bind a Web Test to a Text File.

If you want more control over the format of your text file, you can add an additional file to your data source. This file will contain schema information that describes the structure of the text data.

Adding a Schema Definition to a Text File Data Source

To add a schema definition to a text file data source

  1. Create a new text file named schema.ini in your data folder. Your data folder contains the text files your schema file describes.

  2. Edit the schema.ini file to add the information that describes the structure of your data. For example, a schema file describing two text files might look like this:

    [product.txt]
    ColNameHeader=False
    Format=CSVDelimited
    MaxScanRows=25
    CharacterSet=OEM
    Col1=ProductId Char Width 255
    Col2=ModelNumber Char Width 255
    
    [customer.txt]
    ColNameHeader=True
    Format=TabDelimited
    

     

File Name

The name of the file that contains the data appears between []. More than one text file can be described in the schema file, but the schema file and all text files it describes must be in the same directory.

ColNameHeader

ColNameHeader should be set to True if your data file has a header row of column names, or False if it does not.

Format

Format can be one of the following values:

TabDelimited

Fields are delimited by tabs.

CSVDelimited

Fields are delimited by commas.

Delimited(*)

Fields are delimited by asterisks. You can substitute any character for the * except for the double quotation mark (“).

FixedLength

Fields in the text are of a fixed width.

CharacterSet

CharacterSet can be either OEM or ANSI.

Data Columns

To describe the column names and data types the format should be ColN ColumnName Type Width #, as described in the following table:

ColN

N is the column number.

ColumnName

The column name.

Type

The data type. Allowed values are Char, Text, Float, Double, Integer, Short, LongChar, Memo, and Date.

Width X

(Optional) This is used for text files that have a fixed width format. X is the width of the column. If you specify the width for a file that is delimited, it will be ignored.

See Also

Tasks

How to: Add Data Binding to a Web Test
How to: Bind a Web Test to a Text File

Concepts

About Data Binding in Web Tests

Other Resources

Data Binding in Web Tests