I am very new to QA Complete. I am trying to write a script to read the file, I was told that QA Complete accepts VB script, but for some reason the QA complete as rejected the syntax.
[ QUOTE ]
Dim sFileText as String
Dim iFileNo as Integer
iFileNo = FreeFile
'open the file for reading
Open "C:\Test.txt" For Input As #iFileNo
'change this filename to an existing file! (or run the example below first)
'read the file until we reach the end
Do While Not EOF(iFileNo)
Input #iFileNo, sFileText
'show the text (you will probably want to replace this line as appropriate to your program!)
'close the file (if you dont do this, you wont be able to open it again!)
(note: an alternative to Input # is Line Input # , which reads whole lines).
[/ QUOTE ]
Also I am in middle of review, can some one also tell me how great this tool is with Window application (developed in VB6 and C#)
[/ QUOTE ]
First of all, I recommend that you see the "Getting Started" section of TestComplete's Help system. A printable version of this section (Getting Started With TestComplete 7.doc) is located in the "<TestComplete 7>\Help" folder.
The "Working With Applications' Objects and Controls" help topic can also be useful for you.
Here's a script we use for reading text files. This will write the contents line by line to TestComplete log.
Dim oFSO, ots, s
Const ForReading = 1
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set ots = oFSO.OpenTextFile(sFilename, ForReading)
ReadFile = ots.ReadAll
' Not sure if the following function will work as output of above may not be an array. Give it a try anyway, but I know for sure the above works.
Sub DisplayLinesRead (lines)
L = UBound(lines)
for i = 0 to L-1
log.message "[" & lines(i) & "]"