| || |
include file in qtp
From the web i got the following code to include the files
<font class="small">Code:</font><hr /><pre> Sub IncludeFile (ByVal FileName)
Const ForReading = 1
Dim oFSO:Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim f: set f = oFSO.OpenTextFile(FileName, ForReading)
Dim s: s = f.ReadAll()
And also we can associated the lib files use Test>>Setting>>Resources to include the files, but i think it is not convenient to maintain and also not easy to directly read from the code, so is there any code can we use to do the above action?
I just want to use more code not use the function provided by QTP. And my purpose is to store all the object repository in the files and all use Description.Create to create the properies collection.
And beside above two ways, is there any method to do so?
Re: include file in qtp
I suppose you could use the above technique for library inclusion in QTP. But that code snippet exists for WSH vbScripts because the WSH runtime does not provide a file inclusion mechanism, while QTP offers two:
1. Include libs via the Test Settings Resource tab, and/or
2. Include libs using the ExecuteFile(lib) statement
But these techniques have substantially different behaviors that are described in the 2nd thread below, which is from the FAQs thread at the top of the first page on this forum:
27 Including Libraries in QTP
27.A Basics: http://www.knowledgeinbox.com/docume...raryfiles.html
27.B Advanced: http://www.sqaforums.com/showflat.ph...;Number=396463
Read both of these carefully before selecting a technique that is appropriate for your situation.
And in the future: please check the FAQs FIRST, search the forum SECOND and post what you then believe to be a new question LAST, before posting again.