loadrunner-parameters chapter 7

16
Krish Hegde 1 Parameters • When you record a business process, VuGen generates a script that contains the actual values used during recording. Suppose you want to perform the script’s actions (query, submit, etc.) using different values from those recorded. • To do this, you replace the recorded values with parameters. This is known as parameterizing the script.

Upload: api-3738664

Post on 13-Nov-2014

106 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LoadRunner-Parameters Chapter 7

Krish Hegde 1

Parameters

• When you record a business process, VuGen generates a script that contains the actual values used during recording. Suppose you want to perform the script’s actions (query, submit, etc.) using different values from those recorded.

• To do this, you replace the recorded values with parameters. This is known as parameterizing the script.

Page 2: LoadRunner-Parameters Chapter 7

Krish Hegde 2

Parameters

Advantages with Parameterizing:

1. It reduces the size of the script.

2. It provides the ability to input unique values.

Page 3: LoadRunner-Parameters Chapter 7

Krish Hegde 3

Parameterize Functions

Parameterization involves the following two tasks:

1. Replacing the constant values in the Vuser script with parameters

2. Setting the properties and data source for the parameters

Page 4: LoadRunner-Parameters Chapter 7

Krish Hegde 4

Parameterize Functions

• To create a parameter:1 Right-click on the string to parameterize. The

right-click pop-up menu opens.2 From the pop-up menu, select Replace with a

Parameter. The Select or• Create Parameter dialog box opens.3. Type a name for the parameter in the

Parameter name box, or select an existing parameter name from the list.

4. Select a parameter type from the Parameter type list.

5. Click OK.

Page 5: LoadRunner-Parameters Chapter 7

Krish Hegde 5

Parameter Properties

• After you create a parameter, you define its properties. A parameter’s properties define the data source the parameter uses during script execution. To define parameter properties:

1. Right-click on the parameter. The right-click pop-up menu opens.

2. From the pop-up menu, select Parameter Properties.

3. Enter the properties of the parameter.4. Click Close.

Page 6: LoadRunner-Parameters Chapter 7

Krish Hegde 6

Parameters

• Different types of Parameters:1. File2. Date/time3. User ID4. Group Name5. Iteration number6. Load Generator name7. Random Number parameter8. Unique number9. User Defined Function10.User File path.

Page 7: LoadRunner-Parameters Chapter 7

Krish Hegde 7

Parameters

• File type:– A file contains the values for the parameter you define in your

Vuser script. When you run a Vuser script, the Vuser replaces the parameter with the values from the data file.

– You can create a file using VuGen or you can use an existing file. The file must have a .dat or .txt extension.

• Date / Time:– Replaces the parameter with the current date and /or time. To

specify a date/time format, you can select a format from the menu list or specify your own format.

– You should select the format of the date and time as it appears in your script.

Page 8: LoadRunner-Parameters Chapter 7

Krish Hegde 8

Parameters

• Vuser ID type Parameters:– Replaces the parameter with the ID assigned

to the Vuser by the Controller during the scenario run.

– When you run a script from VuGen, the Vuser ID is always 1.

Page 9: LoadRunner-Parameters Chapter 7

Krish Hegde 9

Parameter Source

• When you define a parameter’s properties, you specify the source for the parameter data. You can specify either of the following data source types:

• Internal Data: Data that is generated internally by the Vuser.

• Data Files: Data that is contained in a file—either an existing file or one that you create with VuGen.

Page 10: LoadRunner-Parameters Chapter 7

Krish Hegde 10

Data Files

Data Files• Data files hold data that a Vuser accesses

during script execution. Data can be stored in local or global files. You can specify an existing ASCII file or use VuGen to create a new one. Data files are useful if you have many known values for your parameter.

• The data in a data file is stored in the form of a table. One file can contain values for many parameters. Each column holds the data for one parameter. Column breaks are marked by a delimiter, for example, a comma.

Page 11: LoadRunner-Parameters Chapter 7

Krish Hegde 11

Data Files

• When you use a file as the source of data for a parameter, you must specify the following:

1. the name and location of the file

2. the column containing the data

3. the file format, including column delimiter

4. an update method

Page 12: LoadRunner-Parameters Chapter 7

Krish Hegde 12

Data Files

Page 13: LoadRunner-Parameters Chapter 7

Krish Hegde 13

Data Files

• Type a name for the data file in the File path box, or click Browse to specify the file location of an existing data file.

• Click Edit. Notepad opens with the parameter’s name in the first row and original value in the second row. Enter additional column names and values into the file in the form of a table.

• To add a column to the data file without launching Notepad, click Add Col in the Parameter Properties dialog box.

Page 14: LoadRunner-Parameters Chapter 7

Krish Hegde 14

Updating Parameter Values from Files

• When using values from a file, VuGen lets you specify the way in which you assign values to the parameters. The available methods are:

1. Sequential2. Random3. Unique4. Same line as <parameter>

Page 15: LoadRunner-Parameters Chapter 7

Krish Hegde 15

Verifying Correct execution

• After replacing the value with the parameter run the script and check whether it successfully works.

Page 16: LoadRunner-Parameters Chapter 7

Krish Hegde 16

• Questions?