SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Join Date
    Aug 2005
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Setting Library files as resources during run time

    Hi,

    Can anyone please tell me if there is a way to programmatically set the test resources?

    I tried the following code:

    Dim App, AppLib
    Set App = CreateObject("QuickTest.Application")
    App.Launch
    App.Visible = True
    App.Open "C:\Tests\Test1"
    Set AppLib = App.Test.Settings.Resources.Libraries
    AppLib.Add("C:\Libraries\SampleLib.vbs")
    App.Test.Save


    But I get the error 'operation failed because the application is busy' at the line (App.Open "C:\Tests\Test1")

    I get the error 'This operation cannot be performed during a run session.' at the line AppLib.Add("C:\Libraries\SampleLib.vbs")

    The reason I'm trying this is, when I Execute a library file from my driver script, the library file is not accessible to any of the external reusable actions that are called from the driver script.
    If we set the library file as one of the resource files in test settings, the library file is available for the driver script and all the reusable actions called from it.
    However, we want to avoid manually setting the test options for all the test scripts.

    Do let me know if any one has a suggestion.
    Thanks.

  2. #2
    Senior Member
    Join Date
    Feb 2001
    Location
    USA
    Posts
    776
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Setting Library files as resources during run time

    Lets say you have 3 library files

    c:\1.vbs
    c:\2.vbs
    c:\3.vbs

    Now create one more file called GlobalLibrary.vbs.
    Open GlobalLibrary.vbs and type following
    ExecuteFile "c:\1.vbs"
    ExecuteFile "c:\2.vbs"
    ExecuteFile "c:\3.vbs"

    Save the C:\GlobalLibrary.vbs file.

    Open the your QTP script file and Beginning of the script type following.

    ExecuteFile "C:\GlobalLibrary.vbs"

    Prashant Patel
    Thanks,
    Prashant Patel

  3. #3
    Junior Member
    Join Date
    Aug 2005
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Setting Library files as resources during run time

    Thanks for the reply, Prashant. I'm executing just one library file from the driver script. Even then, its not available for any external actions that are called from the driver script.I get the error 'Type Mismatch' from the actions when tried to access functions from the library file.

  4. #4
    Member
    Join Date
    Aug 2005
    Location
    Chennai
    Posts
    96
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Setting Library files as resources during run time

    ravisha
    check whether both ur QTP and your vbs file are not in use when executing this automation script for doing the activiy.

    and also check if the sciript is not locked by some other potential users

    regards
    Rajesh Kumar Chengalpathy

  5. #5
    Senior Member
    Join Date
    Jan 2000
    Location
    USA, CA
    Posts
    1,998
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Setting Library files as resources during run time

    error 'Type Mismatch' means:
    there is some error in your script.
    You need to debug it.
    It's not relative to importing lib.

  6. #6
    Junior Member
    Join Date
    Aug 2005
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Setting Library files as resources during run time

    Thanks for the replies again. But I dont have the files locked. If I set the same library file as one of the resources in test settings, I do not have any problem, neither do I get the 'Type mismatch' error.
    Thats the reason I was trying to set the library file as one of the resource files from the driver script. But I'm facing the problem there too as I've mentioned above.

  7. #7
    Senior Member
    Join Date
    Feb 2001
    Location
    USA
    Posts
    776
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Setting Library files as resources during run time

    Try to put below code into .vbs file then double click on the .vbs file. I tried and it worked for me.

    Dim App, AppLib
    Set App = CreateObject("QuickTest.Application")
    App.Launch
    App.Visible = True
    App.Open "C:\Tests\Test1"
    Set AppLib = App.Test.Settings.Resources.Libraries
    AppLib.Add("C:\Libraries\SampleLib.vbs")
    App.Test.Save

    [ 10-11-2005, 11:20 AM: Message edited by: ppat7046 ]
    Thanks,
    Prashant Patel

  8. #8
    Junior Member
    Join Date
    Aug 2005
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Setting Library files as resources during run time

    This seems to work. I got a confirmation from mercury support as well that there is no other way to set the associated library files for a test.Thanks.

  9. #9
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Setting Library files as resources during run time

    The problem here is that you are not allowed to add resource file during run-time in a script. So if you try anything in any script file also that would also mean the execution of that code when you execute the script. But when you put this code in a script file only and run that script file then the test is not in run mode. thats wahy this thing works.

    Now the best possible solution i had figured out was that we should include as Loader vbs file which in turn calls ExecuteFile function on all the required library files. This make all the functions in all the library files available to all the actions

  10. #10
    Senior Member
    Join Date
    Feb 2001
    Location
    USA
    Posts
    776
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Setting Library files as resources during run time

    Tarun is right. That is what I have been doing and it works just fine.

    Prashant Patel
    Thanks,
    Prashant Patel

 

 
Page 1 of 2 12 LastLast

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 07:54 AM.

Copyright BetaSoft Inc.