• No results found

Selecting or Creating Data Files or Data Tables

In document HP Loadrunner 8.1 (Page 164-170)

When you create a File or Table type parameter you have to create a .dat file to store the data, or open an existing one. Then you define the other properties for the parameter, such as how the Vuser should assign values to the parameter.

You can create a new data table or select an existing data source from the File Path list.

To select a source file or table for your data:

1 Open the Parameter Properties dialog box or the Parameter List.

For instructions, see “Defining Parameter Properties” on page 122.

2 Select a table or create a new one.

If there are no tables (.dat files) listed in the file path list, or you want to create a new table, click Create Table. VuGen creates a new table with one cell, displaying the original value of the argument in the first column of the table.

To open an existing data file, type the name of the .dat file in the File path box or choose a name from the drop-down list.

Alternatively, click Browse to specify the file location of an existing data file. By default, all new data files are named <parameter_name>.dat and are stored in the script’s directory.

VuGen opens the data file and displays the first 100 rows. To view all of the data, click Edit with Notepad and view the data in a text editor.

Note: You can also specify a global directory. Global directories are provided only for backward compatibility with earlier versions of VuGen.

For more information, see “Global Directory” on page 130.

To import data from an existing database, click Data Wizard and follow the wizard’s instructions. For more information, see “Importing Data from an Existing Databases” on page 126.

3 Add columns and rows to the table.

To add additional columns to the table, choose Add Column. The Add new column dialog box opens. Enter a column name and click OK.

To add additional rows to the table, choose Add Row.

4 Edit the data file.

Click within any cell to enter a value.

To edit the data file from within Notepad, click Edit with Notepad.

Notepad opens with the parameter’s name in the first row and its original value in the second row. Enter additional column names and values into the file using a delimiter such as a comma or a tab to indicate a column break. Begin a new line for each table row (for each new row of data).

Importing Data from an Existing Databases

VuGen allows you to import data from a database for use with parameterization. You can import the data in one of two ways:

Creating a New Query

Specifying an SQL Statement

VuGen provides a wizard that guides you through the procedure of importing data from a database. In the wizard, you specify how to import the data—create a new query via an MS Query or by specifying an SQL statement. After you import the data, it is saved as a file with a .dat extension and stored as a regular parameter file.

To begin the procedure of importing a database, click Data Wizard in the Parameter List dialog box (Vuser > Parameter List). The Database Query Wizard opens.

Creating a New Query

You use Microsoft’s Database Query Wizard to create a new query. This requires the installation of MS Query on your system.

To create a new query:

1 Select Create query using Microsoft Query. If you need instructions on Microsoft Query, select Show me how to use Microsoft Query.

2 Click Finish. If Microsoft Query is not installed on your machine, VuGen issues a message indicating that it is not available. Install MS Query from Microsoft Office before proceeding.

3 Follow the instructions in the wizard, importing the desired tables and columns.

4 When you finish importing the data, choose Exit and return to Mercury Virtual User Generator and click Finish. The database records appear in the Parameter Properties box as a data file.

To edit and view the data in MS Query, choose View data or edit in Microsoft Query.

5 Set the data assignment properties. See “Setting Properties for File Type Parameters” on page 130.

Specifying an SQL Statement

To specify a database connection and SQL statement:

1 Select Specify SQL Statement. Click Next.

2 Click Create to specify a new connection string. The Select Data Source window opens.

3 Select a data source, or click New to create a new one. The wizard guides you through the procedure for creating an ODBC data source. When you are finished, the connection string appears in the Connection String box.

4 In the SQL box, type or paste an SQL statement.

5 Click Finish to process the SQL statement and import the data. The database records appears in the Parameter Properties box as a data file.

6 Set the data assignment properties. See “Setting Properties for File Type Parameters” on page 130.

After creating table or file data, you set the assignment properties. The properties specify the columns and rows to use, and whether to use the data randomly or sequentially. You set the properties separately for the File and Table type parameters.

Note: You can also set the properties for a parameter from the Parameter List dialog box. In the left pane, select the parameter and then specify its properties in the right pane. See “Using the Parameter List” on page 127.

In document HP Loadrunner 8.1 (Page 164-170)

Related documents