|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
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: Add a CSV File Data Source to a Web Test and How to: Add Data Binding to a Web Request.
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.
To add a schema definition to a text file data source
Create a new text file named schema.ini in your data folder. Your data folder contains the text files your schema file describes.
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
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 should be set to True if your data file has a header row of column names, or False if it does not.
Format can be one of the following values:
Fields are delimited by tabs.
Fields are delimited by commas.
Fields are delimited by asterisks. You can substitute any character for the * except for the double quotation mark (").
Fields in the text are of a fixed width.
CharacterSet can be either OEM or ANSI.
To describe the column names and data types the format should be ColN ColumnName Type Width #, as described in the following table:
N is the column number.
The column name.
The data type. Allowed values are Char, Text, Float, Double, Integer, Short, LongChar, Memo, and Date.
(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.