Recent Posts

QTP & Keyword Driven Testing

Tricky Questions in QTP

Asset Upgrade tool in QTP

New Features in QTP 10

Dec 2, 2008

QTP - Passing Parameters between Actions

Subscribe the QA and Software Testing Newsletter
Post Your Queries | QA and Testing - Table of Contents

SPONSORED LINKS Reading: QTP - Passing Parameters between ActionsTweet this Post

We can pass parameters in a Action Using input and output parameters.

Let’s take one example:
There are two actions in Test Script.Action1 and Action2. Action1 is Reusable. In Action2 we call Action1.How to Pass value from Action2 to Action1 and use it in Action1

Way 1:

So Now If you need pass parameters between actions first we have to add then in the action properties

Step->ActionProperties->Parameters
For your problem we have to add a new input parameter "x" for Action1
then write the following code in Action2
RunAction "Action1", AllIterations,k where k is the value being passed to action1 and should be defined with some value in action2

then write the following code in Action1

msgbox parameter("x")

Way 2:

Scenario: suppose you call Action2 from Action1 and Action2 has one input and one output parameter defined.

RunAction "Action2", oneIteration, “MyValue”, MyVariable

Supplies a string value of MyValue for the input parameter and stores the resulting value of the output parameter in a variable called MyVariable.

Sequence of events:
1. Create two Actions:
New Test -> Go to Insert -> Call to New Action -> Select "After the current step". Press OK.
2. Define Input Test Parameter:
Go to Test -> Settings -> Parameters tab -> ADD Input Parameter -> Enter the values, Press Apply and OK
For Action 1:
3. Define an input parameter for Action1:

Right-clicking on Action1 and select Action Properties -> Parameters tab -> ADD Input Parameter -> Enter the values, Press Apply and OK

Again Right-click on Action1 and select Action Call Properties -> Parameters tab -> Click on the cell under the Value column for [Parameter 1 of Action 1].

You will see a button on the right of the cell, click it. Select "Parameter" and "Test Parameter".
In the Name drop-down list, select "TestParam", which matches the input parameter created in the test settings.

Repeat Sequence 3 (Step 3) for Action 2 also. The name of input parameter for Action 2 will be “Param2”. Select [Parameter 1 of Action 1] in the Name dropdown.

4. Go to the Expert View of Action 2 and write the following code:
msgbox Parameter("Param2")

The above steps can be repeated if you wish to pass more Parameters

SPONSORED LINKS

Comments :

0 comments to “QTP - Passing Parameters between Actions”

Software testing Metrices-Test Case Review

Metrics are the means by which the software quality can be measured; they give you confidence in the product.

 

Energize your test team

You're waist deep in your third month of late nights, weekends, and shipping stress; you can see and feel your team's energy waning.

 

The Value of Positive Testing

There is a school of thought in software testing that debunks the value of positive testing. This school basically states that any test that does not produce a defect is not a good test.

Impact Analysis Checklist for Req. Changes
___    Implications of the Proposed Change* Identify any existing requirements in the baseline that

The Process of Test Process Improvement

Software testing is still a pain-in-the-neck for many organizations. Because it is only marginally addressed in software process improvement models like CMMi

 

Software Defect-bug Management Philosphy

Imperfect processes cause most of the software defects. Thus to prevent defects, the development process needs to be overhauled.

 

Software testing Metrices-Test Case Review

Metrics are the means by which the software quality can be measured; they give you confidence in the product.

 

Energize your test team

You're waist deep in your third month of late nights, weekends, and shipping stress; you can see and feel your team's energy waning.

 

The Value of Positive Testing

There is a school of thought in software testing that debunks the value of positive testing. This school basically states that any test that does not produce a defect is not a good test.

Blog Archive