07-08-2014, 10:34 AM
Hi
I want to read the data from a text file and write the result for that data set in the text file at the same time how can i do that in QTP
File Format:-
DATE##FLYFROM##FLYTO##NAME##TICKET##Result
073014##Denver##Paris##Test1##1
072514##Paris##Denver##Test2##2
I want to write the result (pass/fail) under the RESULT col.
Code:-
Can someone please help me with this
I want to read the data from a text file and write the result for that data set in the text file at the same time how can i do that in QTP
File Format:-
DATE##FLYFROM##FLYTO##NAME##TICKET##Result
073014##Denver##Paris##Test1##1
072514##Paris##Denver##Test2##2
I want to write the result (pass/fail) under the RESULT col.
Code:-
Code:
systemutil.run"C:\Program Files (x86)\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"
Dialog("Login").WinEdit("Agent Name:").Set "mercury"
Dialog("Login").WinEdit("Password:").SetSecure "53ba23c99f935b004bba9a2ac1279aec43b6e7d8"
Dialog("Login").WinButton("OK").Click
Set FSO = createobject("scripting.fileSystemObject")
'FSO.CreateFolder("D:\Poulomi\Test1")
'FSO.CreateTextFile("D:\Poulomi\Sample1.txt")
'set Ofile1= FSO.OpenTextFile("D:\Poulomi\Sample2.txt",2)
Set Ofile = FSO.OpenTextFile("D:\Poulomi\Sample2.txt",1)
'Ofile.Write"HELLO"
Ofile.SkipLine
While Ofile.AtEndOfStream <> true
resobj = Ofile.readline
' msgbox resobj
arrobj = split(resobj,"##")
dtdate = arrobj(0)
flyfrom = arrobj(1)
flyto = arrobj(2)
name = arrobj(3)
txt = arrobj(4)
' msgbox dtdate
' msgbox flyfrom
' msgbox flyto
' msgbox name
' msgbox txt
'Ofile1.Write"##"
Window("Flight Reservation").ActiveX("MaskEdBox").Type dtdate
Window("Flight Reservation").WinComboBox("Fly From:").Select flyfrom
Window("Flight Reservation").WinComboBox("Fly To:").Select flyto
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set name
Window("Flight Reservation").WinButton("Insert Order").Click
Window("Flight Reservation").Dialog("Flight Reservations").WinButton("OK").Click
Window("Flight Reservation").WinMenu("Menu").Select "File;New Order"
Wend
Ofile.Close
Set Ofile=nothing
Set FSO=nothing
Can someone please help me with this