When we have developed automation framework, we also keeping execution log in it. Here I have given sample function for creating log file.
Function CreateLogFile
Dim
Curtime, LogFilePath, FilePath ‘Declaration part
Curtime=Now()
‘This will give result like 1/1/2015 12:00:00 PM
Curtime=Replace(Curtime,”/”,”-“)
Curtime=Replace(Curtime,”:”,”_”)
Environment(“FilePath”)=”C:\QTP ‘Creating Environment variable
Environment(“FilePath”)=FilePath
LogFilePath=FilePath
& “Results\” & Curtime & “.log”
Environment(“LogFilePath”)=LogFilePath
Set Fso=CreateObject(“Scripting.FileSystemObject”)
Fso.CreateTextFile
LogFilePath
End Function
No comments:
Post a Comment