Working With Test Parameters in QTP

QTP Provides feature called Test Parameters, similar to Action Parameters which are used for sharing data between multiple actions.

The Test Parameters are of two types as shown in Fig -1 below . The Test parameter pane contains two parameter lists:

1.       Input parameters: Specifies the parameters that the test can receive values from the source that runs or calls it.

2.       Output parameters. Specifies the parameters that the test can pass to the source that runs or calls it.

 

 

Fig – 1- Showing Test Parameters Pane in QTP

 

To Access the Test Parameter we use TestArgs just as we use Parameter to access Action Parameters.

For e.g

In Fig 1 shown above we  have 2 Test Input Parameters i.e  a and b and 1 Output Test Parameter i.e result.

 

Sample Script to Demonstrate Test Parameters Usage

TestArgs(“a”) = 10

TestArgs(“b”) = 20

 

res = TestArgs(“a”)  + TestArgs(“b”)

 

TestArgs(“result”) = res

 

MsgBox    “Test Parameter 1 =  ” &TestArgs(“a”) & vbnewline &_

“Test Parameter 2 =  ” &TestArgs(“b”)  & vbnewline &_

“Result = ” & res

 

Script Output

 

 

 

 

Advertisements

One comment on “Working With Test Parameters in QTP

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s