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
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