SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Sep 2007
    Posts
    84
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Dynamically load function libraries

    Hi,

    I'm writing a QTP framework. QTP version 9.5
    The framework uses a number of .qfl libraries.
    I now add the libraries manually to the tests.

    However, if the location of the library changes, or if I need other libraries at my tests, I have to change the settings manually.
    This will not be possible anymore if the test set grows.

    To solve this problem I want to add the function libraries at runtime.
    However, this seems not to be possible.
    see also: #568521 - 05/12/09 07:12 AM

    Code I used:

    Dim qtApp 'As QuickTest.Application
    Dim qtLibraries 'As QuickTest.TestLibraries
    Set qtApp = CreateObject("QuickTest.Application")
    Set qtLibraries = qtApp.Test.Settings.Resources.Libraries

    If qtLibraries.Find("y:\temp\my_functions.qfl") = -1 Then
    qtLibraries.Add "y:\temp\my_functions.qfl", 1
    End If


    This does not work as I use it at runtime.

    I cannot use this code <u>before</u> runtime, as the QTP-tests will be started from Quality Center, within a terminal window. (many people sharing the same QC and QTP).

    Does someone have a practical solution?
    The solution may also be something else than above code.
    I just want to prevent that someone has to change manually the associated function libraries of 2000 tests.

    Kind regards.

    Kind regards,

    Erik

  2. #2
    Senior Member
    Join Date
    Dec 2006
    Location
    Germany, Dresden
    Posts
    1,536
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Dynamically load function libraries

    search forum for "ExecuteFile"
    http://qcmt.pc-polis.de

    de omnibus dubitandum

    For all Questions: Please be sure to take a look at the QTP Manual before posting any Questions, thanks for doing this

  3. #3
    Member
    Join Date
    Sep 2007
    Posts
    84
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Dynamically load function libraries

    Thanks!

    It works!

    code in main script:
    ExecuteFile "y:\temp\my_functions.qfl"

    This qfl will be used to load the other function libraries, so I can change the code on a central point now.

  4. #4
    Member
    Join Date
    Dec 2009
    Posts
    48
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Dynamically load function libraries

    I've implemented a generic solution to this problem that will automatically discover all function libraries that are associated with external actions. You can find the solution here:

    https://briandamaged.org/blog/?p=307

  5. #5
    Member
    Join Date
    Dec 2009
    Posts
    48
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Dynamically load function libraries

    I should add this this solution only works when Quality Center is used as the storage backend. However, I'm sure you could use a similar approach to load test resources stored on the local filesystem as well.

  6. #6
    Senior Member
    Join Date
    Sep 2006
    Location
    CA, USA
    Posts
    425
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Dynamically load function libraries

    [ QUOTE ]
    Thanks!

    It works!

    code in main script:
    ExecuteFile "y:\temp\my_functions.qfl"

    This qfl will be used to load the other function libraries, so I can change the code on a central point now.

    [/ QUOTE ]


    I doubt it works for 2 reasons:

    1. ExecuteFile is used for .vbs so I guess you executed a .vbs instead of .qfl. The .qfl can be executed instead you can execute a list of functions.

    2. QTP prevented you from both App.Test.Resources.Libraries.RemoveAll/Add at runtime.

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

    Re: Dynamically load function libraries

    ExecuteFile works just fine on .qfl files.

  8. #8
    Member
    Join Date
    Dec 2009
    Posts
    48
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Dynamically load function libraries

    Just to avoid confusion:

    First, the "It works" was posted before my code snippet. I just posted the code in case anyone else was facing a similar issue.

    Second, the code I posted does not Add/Remove libraries at runtime. It only queries the model to find which resources are needed, and then it calls ExecuteFile on these resources. This allows the Driver Test to behave as if the libraries have been correctly associated with it. In fact, the "associations" only exist at runtime. This is crucial because it allows the Driver Test to automatically adapt to any changes made to the external Actions and Tests.

 

 

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 9.38%
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:08 PM.

Copyright BetaSoft Inc.