Hi, I've developed some code here. I' working on RFT now... If any syntax's mixed with java, Plz ignore and convert into VBScript.
I'm writing this with out using QTP. just I analyzed and developed... check it once and revert me if you get any issues with this.
Here, you can first create a text file at your desired location and then pass the values required to the function. just call this function and conclude that the passing text has been appended to file.
Thanks & Regards,
Baba Fakruddin.D
I'm writing this with out using QTP. just I analyzed and developed... check it once and revert me if you get any issues with this.
Here, you can first create a text file at your desired location and then pass the values required to the function. just call this function and conclude that the passing text has been appended to file.
Code:
public function fncAppendFile(path_of_the_file, updating_text_into_file)
dim fso, fs
dim txtBefore, txtAfter
int intlenBefore, intlenAfter, intlenAppTxtString
intlenAppTxtString = len(updating_text_into_file)
set fso = createobject("Scripting.filesystemobject")
set fs = fso.opentextfile("path_of_the_file", 8)
txtBefore = fs.readall
intlenBefore = len(txtBefore)
fs.writeline(updating_text_into_file)
fs.save
txtAfter = fs.readall
intlenAfter = len(txtAfter)
if (intlenAfter=intlenBefore+intlenAppTxtString) Then
fncAppendFile = True
fs.close
else
fncAppendFile = False
fs.close
End if
set fso = nothing
set fs = nothing
End function
Dim path_of_the_file, updating_text_into_file
path_of_the_file = " your desired path of the text file"
updating_text_into_file = " The text you want to append to text file is here"
result = fncAppendFile(path_of_the_file, updating_text_into_file)
if(result = True) Then
reporter.reportevent "micpass", "The string is appended to file successfully"
else
reporter.reportevent "micfail", "The string is not appended to file"
end ifBaba Fakruddin.D

