HP LoadRunner VuGen Questions Bank: Q. 51 to 60
Learn “VuGen” Module of HP LoadRunner through FAQs:
Q. 51: What special commands are available for parameterization of VuGen generated Vuser scripts?
1) We can use the lr_eval_string function to “parameterize” a function argument which cannot be parameterized by using standard parameterization.
2) We can use the lr_eval_string function to “parameterize” any string in a Vuser script.
3) For VB, COM, and Microsoft .NET protocols, we need to use the lr.eval string function to define a parameter. For example,
r.eval_string(“{Custom_param}”).
<<<<<< =================== >>>>>>
Q. 52:How many Parameter Types are there in Vugen?
While creating a parameter, we specify the following four type of sources for the parameter data. Accordingly there are four type of parameters like:
1) File or Table Parameter
2) XML Parameter
3) Internal Data Parameter
4) User-Defined Function
<<<<<< =================== >>>>>>
Q. 53: What are Datafiles?
Data files store all the data accessed by the Vuser during script execution. Data files are of two types viz. 1) Local Data Files 2) Global Data Files.
Data files are useful when we have many known values for our 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 like a comma. For example, the undermentioned data file contains ID numbers and the Name of the persons:
id,name
250,Arun
251,Vivek
252,Sneha
We can use an existing ASCII file, or can import a database file or can instruct VuGen to create a new datafile for us.
<<<<<< =================== >>>>>>
Q. 54: What are File and Table Parameter Types?
While creating a parameter, we specify the source of the parameter data. We use parameters, by instructing the Vusers to take values from an data table or an external file which contains values defined by the user.
These parameters are called File and Table type parameters.
The Table parameter type is meant for applications needing testing by filling in table cell values. Whereas the file type uses one cell value for each parameter occurrence, the table type uses several rows and columns as parameter values, similar to an array of values. Using the table type, we can fill in an entire table with a single command.
<<<<<< =================== >>>>>>
Q. 55: What are the XML Parameter Types?
XML Parameter Types are the placeholder for multiple valued data contained in an XML structure. We can use an XML type parameter to replace the entire structure with a single parameter. For example, an XML parameter by the name Address can replace a contact name, an address, city, and postal code.
With the help of XML parameters we can have cleaner input of the data, and enables cleaner parameterization of Vuser scripts. XML parameters are recommended for use with Web Service scripts or for SOA services.
<<<<<< =================== >>>>>>
Q. 56: What are the Internal Data Parameter Types?
Internal data gets created automatically when a Vuser runs. These are like Date/Time, Group Name, Iteration Number, Load Generator Name, Random Number, Unique Number, and Vuser ID etc.
We can define the properties for the data getting generated internally by the Vuser.
<<<<<< =================== >>>>>>
Q. 57: What are the User Defined Parameter Types?
User Defined Parameter Types are the data being generated using a function from an external DLL.
A user-defined function replaces the parameter with a value returned from a function located in an external DLL.
Before we assign a user-defined function as a parameter, we need to create an external library (DLL) with the function. The format of the user defined function is: __declspec(dllexport) char *(char *, char *)
<<<<<< =================== >>>>>>
Q. 58: What is the Global Directory option for Parameterization in VuGen?
Global Directory option is available only for backward compatibility with earlier versions of VuGen. In earlier versions like 4.51 and below, when we created a new data table, there was a need to specify local or global. A local table is saved in the current Vuser script directory and is only available to Vusers running that script. A global table is available to all Vuser scripts. The global directory can be on a local or network drive.
However it is essential that the global directory is available to all machines running the script. We can change the location of the global tables at any time with the help of General Options dialog box.
In newer versions of VuGen, we need to specify the location of the data table either in the Parameter Properties dialog box or in the Parameter List dialog box. VuGen is able to retrieve the data from any location that we specify. It may be either the default script directory or another directory on the network.
<<<<<< =================== >>>>>>
Q. 59: How do we Import Data for parameterization from an Existing Database?
VuGen allows us to import data from a database for use with parameterization. We can import the data in either of the following two ways:
1) Creating a New Query via an MS Query
2) Specifying an SQL Statement
We can use the wizard provided by the VuGen for importing data from a database. Here we need to specify the way of importing the data as described above. After completion of importing the data, it is saved as a file with a .dat extension and stored as a regular parameter file.
<<<<<< =================== >>>>>>
Q. 60: What are the ways to assign data from a file source to the parameters in VuGen?
Three methods are used for assigning data from a file source to the parameters:
1) Sequential Method: It assigns data to a Vuser sequentially. As a running Vuser accesses the data table, it takes the next available row of data. If there are not enough values in the data table, VuGen returns to the first value in the table, continuing in a loop until the end of the test.
2) Random Method: It assigns a random value from the data table to each Vuser at the start of the test run.
When running a scenario, we can specify a seed number for random sequencing. Each seed value represents one sequence of random values used for test execution. Whenever we use this seed value, the same sequence of values is assigned to the Vusers in the scenario. We enable this option in case of any problem in the test execution and there is a need to repeat the test using the same sequence of random values.
3) Unique Method: It assigns a unique sequential value to the parameter for each Vuser.
For using this method we need to ensure that there is enough data in the table for all the Vusers and their iterations. If there are 20 Vusers and we want to perform 5 iterations, our table must contain at least 100 unique values. If there are not enough values in the data table, we can instruct VuGen how to proceed.
Continue to Next Part : Q 61 to 70
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.