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: 227, Answers: 22)
Asked on October 29, 2018 2:16 pm
Answers (1)
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: 477)
Answered on October 29, 2018 2:20 pm

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

Scroll to Top