How do you write Log Files in QTP

Showing Answers 1 - 6 of 6 Answers


  • Apr 26th, 2006

1.Write a program using filesystem objects in qtp.

2.Make this set of statements as function and give it a name eg."LogFile".

3.Capture the output values and other information from the application during runtime.

4.send these values to this function during runtime.

5.In functions write as ...

      a. Store all values in a variable

      b. create sepreate .txt file

      c. pass these values to this file in function

Note: You can also write this function externally and it should be saved as .vbs,  and add this function in "Test-->settings-->Resource" and call this function by its name in Qtp .


  • May 9th, 2006

Plz.......Could anyone send me the script for this Question. "How do you write Log Files in QTP?"

  Was this answer useful?  Yes

Ramakrishna Rao

  • May 9th, 2006

Can you provide one sample script for this?

  Was this answer useful?  Yes


  • May 11th, 2006

i am getting an assigment on QTP,

i have to prepare on my own,

i am familiar with the basic functionality now i want to learn advanced topics

please provide me to get right material


  Was this answer useful?  Yes


  • Jun 3rd, 2007

Log file is used for debugging.
function writelog(strlog)
dim objFSO
dim objFile
set objFSO=createobject("scripting.FileSystemObject")
set objfile=objfso.opentextfile("path")
objfile.writeline strlog
set objfile=nothing
set objFSO=nothing
End function

       hi log files used to show the results to the client ,client can believe by seeing the results produced after execution of the scripts in log files ,
at the end of the path we should give the symbols like 1-read
                                                                                        2- write

  Was this answer useful?  Yes

To write the log files we have to write the programe

To create Log File:--
Class General_Log
Dim objfso,objfile
Function Create_Log(Fname)
set objfso=createobject("scripting.filesystemobject")
set objfile=objfso.createtextfile(str,2,true)

To write text into the Logfile:---
Function Write_Log(org)
str2=date&"   "&time&"   "&org


To execute the file:---
ExecuteFile"Path of the VBS file"
set obj2=new General_Log
obj2.create_Log("path of the logfile to create")
obj2.Write_log("write some text into the file")
set obj2=nothing

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions