How to work with fso(creating objects and reading files) in QTP?
Dim a,b,c
Set a=createobject("scripting.filesystemobject")
Set b=a.createfolder("c:\Open")
Set c=a.CreateTextFile("c:\open\close.txt",true)
If a.FileExists("c:\open\close.txt") Then
Reporter.ReportEvent 0,"Report1","File is created sucessfully"
Else
Reporter.ReportEvent 1,"Report1","File is not created sucessfully"
End If
c.writeline("Madhavi vs QTP")
Set c=a.OpenTextFile("c:\open\close.txt")
e=c.Readall
Set a=createobject("scripting.filesystemobject")
Set b=a.createfolder("c:\Open")
Set c=a.CreateTextFile("c:\open\close.txt",true)
If a.FileExists("c:\open\close.txt") Then
Reporter.ReportEvent 0,"Report1","File is created sucessfully"
Else
Reporter.ReportEvent 1,"Report1","File is not created sucessfully"
End If
c.writeline("Madhavi vs QTP")
Set c=a.OpenTextFile("c:\open\close.txt")
e=c.Readall
msgbox e

Comments
Post a Comment