Tuesday, November 27, 2018

Test Complete- Search data in csv or text file

public function searchdatainfilr()
strfilepath="c:\test. csv
set objfso=createobject(" scripting. filesystemobject")
set infile=objfso. opentextfile("strfilepath")
set outpath=objfso. opentextfile(strfilepath & ". tmp", 2,true)
dim irowcnt
irowcnt=0

do while not infile. atendofstream
line=inline. readline
fullfile=fullfile & line
loop

log. message fullfile
if instr(fullfile, "searctxtval") >0  then
     log. message "validation pass"
else
    log. message "validation fail"
end if
infile. close
outfile. close
objfso. deletefile(strfilepath l
objfso. movefile strfilepath & ". tmp", strfilepath

end function

No comments:

Post a Comment