Highlighted
Absent Member.. vzamoraz Absent Member..
Absent Member..
1953 views

QTP/UFT support tip: How to pass parameters from Test level to Action level in QTP and UFT

QTP Process:

 

1) Define the Test Parameters

On QTP 11 and below

Go to File -> Settings 

Select the Parameters tab.

Click the add button  on Input parameters section.

Enter the values:

   Name: TestParam

   Type: String

   Value: Hello

Click <Apply> and <OK>.

 

2) Define Action Parameters

Right-click on the Action and select Action Properties.


Select the Parameters tab.

Click the add button  for the Input parameters.

Enter the following values:

   Name: Action1Param

   Type: String

Click <OK>.

 

 

How to pass the value from the test parameter to the action parameter?

In the TestFlow View, right click on the Action1 and select Action Call Properties


Select the Parameter Values tab.

Click on the cell Value for Action1Param.

You will see a button on the right of the cell, click it.

Select the "Parameter" radio button. "Test/action Parameter" should be selected by default.

In the Name drop-down list, select "TestParam", which matches the input parameter created in the test settings.

Click <OK>.Note:

 

How to access the value in the script

var = parameter.Item("Action1Param")

msgbox var

 

This will shows the value set in the test parameter "Hello" (in this example)

 

 

UFT process: 

 

1) Define the Test Parameters

On UFT 11.5 and above

Go to Solution explorer Tab and click over the test node (in the screenshot below"GUITEST1")


In the Properties panel select the Parameters tab.


Click the add button  and select Add input parameter.

Enter the values:

   Name: TestParam

   Type: String

   Value: Hello

Click on <OK>.

 

2) Define Action Parameters

Same as Step 1 go to Solution Explorer Tab but this time click over the Action node (Action1 from screenshot below)


As Step 1,  In the Properties panel select the Parameters tab.


Click the add button  and select Add input parameter.

Enter the following values:

   Name: Action1Param

   Type: String

Click <OK>.

 

 

How to pass the value from the test parameter to the action parameter?

In the Canvas View, right click on the Action1 and select Action Call Properties...

 

 

Select the Parameter Values tab.

Click on the cell Value for Action1Param.

You will see a button on the right of the cell, click it.

Select the "Parameter" radio button. "Test/action Parameter" should be selected by default.

In the Name drop-down list, select "TestParam", which matches the input parameter created in the test settings.

Click <OK>.Note:

 

How to access the value in the script

var = parameter.Item("Action1Param")

msgbox var

 

This will shows the value set in the test parameter "Hello" (in this example)

 

 

HP support
If you find that this or any post resolves your issue, mark it as an accepted solution.

 

Labels (1)
1 Reply
Anitak2
New Member.

Re: QTP/UFT support tip: How to pass parameters from Test level to Action level in QTP and UFT

This Link is really help full and resolved the issue which i have faced in UFT12.2 .

My issue was - "Test/Action" parameter option is not available for the paramer i have added. And I have followed the steps you have mentioned and its resolved the issue.

Thank you

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.