Resources Object
Resources Object
Description
Represents the lower part of the Resources pane of the Test Settings dialog box, which enables you to set the external resources associated with your test.
Object Model
Resources Object TestLibraries Collection
Remarks
Tip: You can click the Generate Script button in the General pane of the Test Settings dialog box to automatically generate an automation script containing the current global testing options, including those represented by the Resources object.
Example
'************************************************************************************************************************
'Description:
'
'This example opens a test, configures the test's libraries' collection
'and saves the test.
'
'Assumptions:
'There is no unsaved test currently open in UFT.
'For more information, see the example for the Test.SaveAs method.
'************************************************************************************************************************

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtLibraries 'As QuickTest.TestLibraries ' Declare a test's libraries collection variable
Dim lngPosition

' Open UFT
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Launch UFT
qtApp.Visible = True ' Set UFT to be visible

' Open a test and get its libraries collection
qtApp.Open "C:\Tests\Test1", False, False ' Open a test
Set qtLibraries = qtApp.Test.Settings.Resources.Libraries ' Get the libraries collection object

' Add Utilities.vbs if it's not in the collection
If qtLibraries.Find("C:\Utilities.vbs") = -1 Then ' If the library cannot be found in the collection
    qtLibraries.Add "C:\Utilities.vbs", 1 ' Add the library to the collection
End If

' If we "pushed" Math.vbs - place it back at position 1
If qtLibraries.Count > 1 And qtLibraries.Item(2) = "C:\Math.vbs" Then ' If there is more than one library and Math.vbs is in position 2
    qtLibraries.MoveToPos 1, 2 ' Switch between two first libraries
End If

' If Debug.vbs is in the collection - remove it
lngPosition = qtLibraries.Find("C:\Debug.vbs") ' Try finding the Debug.vbs library
If lngPosition <> -1 Then ' If the library was found in the collection
    qtLibraries.Remove lngPosition ' Remove it
End If

' Set the new libraries configuration as a default
qtLibraries.SetAsDefault ' Set library files associated with the test as default for new ones

'Save the test and close UFT
qtApp.Test.Save ' Save the test
qtApp.Quit ' Quit UFT

Set qtLibraries = Nothing ' Release the test's libraries collection
Set qtApp = Nothing ' Release the Application object
Example
Public Methods
Public Method SetObjectRepositoryAsDefault This method is no longer supported. Use the methods and properties of the ObjectRepositories collection instead.
Public Properties
Public Property DataTablePath The file path of the data table.
Public Property Libraries Returns the TestLibraries object--a collection of the function library files associated with the test or component.
Public Property ObjectRepositoryPath This property is no longer supported. Use the methods and properties of the ObjectRepositories collection instead.
See Also