Parametrization in QTP? -

-->Exclusive Portal for Testing Jobs

Parametrization in QTP?

There are four types of parameters:
  1. Data Table parameters
  2. Test/Action parameters
  3. Environment variable parameters
  4. Random number parameters
1) Data Table Parameters: Data table is just an excel sheet where you can put the data and use this data as a parameter.
There are two types of data table in QTP
Global Sheet: The Data in the global sheet will be available to all the Action of the test in which it is defined.
DataTable("Column Name", dtGlobalShet) = "Value" 'To Add the Value in the Current Row
MsgBox DataTable("Column Name", dtGlobalShet) ' To Reterive the value of the current row of specified column
The Number of rows in the Global Data sheet will define the number of the Test Iteration (It's a Test Iteration and not the Action Iteration. All the action in the test will run)

Local Sheet: The Data in the local sheet is available to only that action in which it is defined. Each and every action has it correspondent sheet with name same as actions' name.
You need to change the Action call Properties to run the multiple iteration of the action depends on the data sheet. 

2) Test/Action Parameters: It's just like the variable we define in other languages. Here it is provided by QTP. There are Three types of parameter
Action Parameter: You can Define the parameter per action. This will not be available to any other action in the test. Syntax to access the parameter. Parameter("Name") = Value ' to assign the new value to parameter Msgbox Parameter("Name") ' to use the parameter value.
Test Parameter: Same as action parameter only the difference is that it will be available to all the actions in the test in which it is define. Syntax to access the Test Parameter. It is useful when you want to pass some parameter from one action to another action in the same test.
TestArgs("Name") = Value ' to assign the new value to parameter.
MsgBox TestArgs("Name") ' to use the Parameter value in test. 

3) Environment Variable Parameters: There are actually two kind of Environment variables.
Build-in: This is the QTP in Build parameter. It containing many of the useful information like UserName, TestDir, etc...
User-Defined: You can define your own Environment Variable here. There are two kind of user define environment variable
  • Internal: You can define our own variable and it's value here 
  • External : You can use the variables from other XML file. But for that you need to have special XML file as below:
of the Variable </Name>
<Value> Value you want to assign </Value>>
Note: external parameter will be read only parameter

4) Random number parameters

To receive daily posted JOBS & Interview Questions
Just enter your email address below and click 'Submit'
Enter your email address:

Make sure to activate your subscription by clicking on the activation link sent to your email