Saturday, September 19

VBScript - 3. Add Resources of the Script

If you had visited my previous blogs ,  you are left from where we need to see the Script that is open needs to be added with resources/check them. Below are the previous which you can take a look
VBScript - 1 . Launching QTP
VBScript - 2 . Connecting to QC/Open QC test

Lets move on to see how can we check the resources that are existing are the right ones and if not add from latest path.



At the end of this blog we would have done following.
Take two resources and add them from the latest path
ResourceName UpdatedPath
fnfunctions.vbs [QualityCenter] Subject/Abcd/
clClasses.vbs [QualityCenter] Subject/Dfgs/


----------------------------------------------------------------------
'Code Begin
'Declare the resources as constant. You necessarily need not do this. You take this input from attributes or excel files or any text file. 
Const Rs_Resource1 = "fnfunctions.vbs"
Const Rs_Resource2  = "clClasses.vbs"
Const Rs_Path1 = "[QualityCenter] Subject/Abcd/"
Const Rs_Path2= "[QualityCenter] Subject/Dfgs/"



Dim appLibraries,fileposition
Set appLibraries = appQtp.Test.Settings.Resources.Libraries 'Get the library collection from Test settings

'Remove all libraries
appLibraries.removeall
appLibraries.add(Rs_Path1&Rs_Resource1) 
appLibraries.add(Rs_Path2&Rs_Resource2)
appLibraries.setasdefault
appQtp.Test.save

set appLibraries = nothing

No comments:

Post a Comment

---------------------------------------------

Related Posts Plugin for WordPress, Blogger...