Resources Object
Description
Object Model

Remarks
Example
Specify Library Files to Associate with a Test (VBScript)
'************************************************************************************************************************
'Description:
'
'This example opens a test, configures the test's libraries' collection
'and saves the test.
'
'Assumptions:
'There is no unsaved test currently open.
'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 the testing application
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Launch the applcation
qtApp.Visible = True ' Set the applcation 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 the applcation
qtApp.Test.Save ' Save the test
qtApp.Quit ' Quit the applcation
Set qtLibraries = Nothing ' Release the test's libraries collection
Set qtApp = Nothing ' Release the Application object
Specify External Resources for a Test
Public Methods
![]() | This method is no longer supported. Use the methods and properties of the ObjectRepositories collection instead. |
Public Properties
![]() | The file path of the data table. |
![]() | Returns the TestLibraries object--a collection of the function library files associated with the test or component. |
![]() | This property is no longer supported. Use the methods and properties of the ObjectRepositories collection instead. |