Let say that you have a library resource item,
Test Resource
A library (attached file is "xyz.vbs")
Call IncludeLib("xyz.vbs")
in the MainTest
'======================================================================
' PURPOSE:
' + Download resource and
' + Include library to the test
'
' PARAMETERS
'
' RETURN: String Value
' + File path
' AUTHOR: Jason Nhien Truong
'======================================================================
Public Function IncludeLib(ByVal psFileName)
Dim oResource, oFilter, oFile,sPath
Set oResource = TDConnection.QCResourceFactory
Set oFilter = oResource.Filter
oFilter.Filter("RSC_FILE_NAME") = psFileName
Set oResourceList = oFilter.NewList
If oResourceList.Count = 1 Then
Set oFile = oResourceList.Item(1)
sPath = oFile.DownloadResource( "", True)
sPath = sPath & "\" & psFileName
IncludeLib = sPath
'Include
Dim oFSO,sContent
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile(sPath, 1)
sContent = oFile.ReadAll
oFile.Close
ExecuteGlobal sContent
Else
DownloadResource = ""
End If
End Function
regards,
Jason Nhien Truong
tmsnhien@gmail.com