SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Action Parameters - passing an Object

    hi folks, to improve my QTP test script i'd like to pass Objects between Actions, however QTP seems to restrict parameters to simple types like String, Bool etc, but not Object type.

    Is there any way around this? i guess i could use Functions instead of Actions, is this the commonly used workaround ?

    any suggestions would be very welcome.

    thanks,
    john.

  2. #2
    SQA Knight
    Join Date
    Jun 2008
    Posts
    2,555
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: Action Parameters - passing an Object

    I use functions exclusively because they perform so much better than actions(lower overhead).

    But you could always pass an object as a string and reconstruct it with descriptive programming.

  3. #3
    Senior Member
    Join Date
    Apr 2005
    Posts
    121
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Action Parameters - passing an Object

    Yeah the best way is to use functions if you can.

    If you have to use Actions and share objects between actions then use "GlobalDictionary". I use this if i have to use actions and share "objects".

    QTP Help:

    To use the Dictionary object, you must first add a reserved object to the registry (in HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\ReservedObjects\) with ProgID = "Scripting.Dictionary". For example:

    HKEY_CURRENT_USER\Software\Mercury Interactive\QuickTest Professional\MicTest\ReservedObjects\GlobalDiction ary

    After you have added the reserved Dictionary object to the registry and restarted QuickTest, you can add and remove values to the Dictionary in one action and retrieve the values in another action from the same test.

    For example, if you want to access the departure date set in the SelectFlight action from the PurchaseTickets action, you can add the value of the DepartDate WebEdit object to the dictionary in the SelectFlight action as follows:

    GlobalDictionary.RemoveAll

    GlobalDictionary.Add "DateCheck", DepartDate

    Then you can retrieve the date from the PurchaseTickets action as follows:

    Dim CompareDate

    CompareDate=GlobalDictionary("DateCheck")

  4. #4
    SQA Knight
    Join Date
    Jul 1999
    Location
    Grand Rapids, MI
    Posts
    3,727
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Action Parameters - passing an Object

    Here is a thread that describes a hack for passing an object <u>reference</u> (objects can't be passed in vbScript, only references) to a called Action:

    http://www.sqaforums.com/showflat.ph...e=0#Post363305

    In this manner the calling and the called Actions share a common data structure of arbitrary complexity and member count to interface with each other.

    You could have found this posting with a simple search of the forum.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:33 AM.

Copyright BetaSoft Inc.