Parameter transfer in qtp

Source: Internet
Author: User
There is an "operation" concept in qtp. In user_guid of qtp, "operation" is called action. In fact, action is a test script. An action can be saved as a script file, or multiple actions can be saved in a script file. (For more information about actions, see qtp User Guide.)
In the keyword view of qtp, you can set the input and output parameters of action. The procedure is as follows:
1. Select the action name and click "right-click -- Action property ",
2. In the displayed parameter Settings dialog box, click the "Parameters" tab and enter the input and output parameters of actjion.
3. After Entering the parameter, click "OK" and then use parameter ("parameter name") to operate the parameter.
4, Code Instance:
Suppose there are test scripts a and B, there are Action1 in A and Action2 in B. Now we need to pass the parameters in Action1 to action2.
First, define the output parameter in Action1. Follow the preceding steps to enter the Parameter Setting Dialog Box. In script A, add the output parameter outputname, whose type is string. then define the input parameter inputname in Action2.
In the keyword view, right-click "-- Action call property" on Action2, click the "parameter values" tab in the pop-up dialog box, and define parameter variables in the tab. The interface
In the displayed "values configration option" dialog box, select the outputname with the input parameter Action1.
Click OK to complete the parameter settings. In this case, Action1 can pass its outputname parameter to Action2 and save it to the inputname parameter variable in action2.
Define the following code in Action1:
Parameter ("outputname") = "this is the Action1 parameter"
Then define the following code in Action2:
Msgbox parameter ("inputname ")
When you run the script in qtp, a prompt box is displayed. The text is "this is the Action1 parameter"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.