Create a custom log file in UFT

Question ID: 108679

How can I create my own log file in UFT to log application items besides using the UFT report? I’m just looking to create something very basic.

Marked as spam
Posted by (Questions: 162, Answers: 22)
Asked on October 29, 2018 2:16 pm
Private answer

One of the easiest ways to create an output file is to use the FileSystemObject. Here's some sample code you can use to create a text file and will show you how to write to it. Just use the WriteLine method throughout your script when you need to log something and then finally close the file at the end of your script:

Set FSO=CreateObject(''Scripting.FileSystemObject'')
Set FS=FSO.CreateTextFile(''C:logsUFTLog.txt'',True)
FS.WriteLine ''Some text to output''
FS.WriteLine ''Some more text''
Set FS=Nothing
Set FSO=Nothing

Marked as spam
Posted by (Questions: 2, Answers: 412)
Answered on October 29, 2018 2:20 pm