Interview Questions   Tutorials   Discussions   Programs   Videos   

QTP - How to read log file using QTP?




227
views
asked marvit August 20, 2014 08:58 AM  

How to read log file using QTP?


           

1 Answers



 
answered By Dharma   0  
This will use to read log file using QTP
Const ForReading = 1, ForWriting = 2
Dim fso, txtFile, txtFile2, strLine1, strLine2, strMatch
Set fso = CreateObject("Scripting.FileSystemObject")
Set txtFile1 = fso.OpenTextFile("C:\Documents and Settings\Desktop\CmdAgent.log", ForReading)
Set txtFile2 = fso.OpenTextFile("C:\Documents and Settings\Desktop\CmdAgent1.log", ForReading)
Set f = fso.OpenTextFile("C:\Documents and Settings\Desktop\result.txt", ForWriting, True)'Difference will be sotred in this file.

Do Until txtFile1.AtEndOfStream
  strLine1 = txtFile1.Readline
    Do Until txtFile2.AtEndOfStream
      strLine2 = txtFile2.Readline
        If Trim(UCase(strLine2)) = Trim(UCase(strLine1)) Then
          strMatch = True
        Else
          f.WriteLine strLine1 & "  " & strLine2 
        End If
    Loop
        If strMatch <> True then
          f.writeline strLine1
        End If
Loop
f.Close

flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert