在QTP运行过程中输出txt文件

上一篇 / 下一篇  2008-08-21 13:52:48

Function WriteLog(LogContent)
logfile=LogName
Const forappending=8
Set ōbjFSO=CreateObject("scrīpting.FileSystemObject")
Set ōbjTextFile=objFSO.OpenTextFile(LogFile,forappending,true)
objTextFile.WriteLine now&chr(9)&chr(9)&LogContent
objTextFile.close
End function

Function LogName
Gethostname hostname
Month1=Month(now)
If month1 >0 and Month1<10 Then
 LongMonth="0" & cstr(Month1)
  else
 longmonth=month1
End If
day1=day(now)
If day1 >0 and day1<10 Then
 Longday="0" & cstr(day1)
  else
 longday=day1
End If
hour1=hour(now)
If hour1 >0 and hour1<10 Then
 Longhour="0" & cstr(hour1)
 else
 longhour=hour1
End If
LogName="Z:\Logs\" &hostname &"_"& year(now) & longmonth & longday & longhour &".txt"
End Function

使用:

WriteLog("Test Pass")

生成的日志为:

8/12/2008 8:10:19 PM  Test Pass


TAG:

 

评分:0

我来说两句

我的栏目

日历

« 2024-04-26  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 5974
  • 日志数: 11
  • 建立时间: 2007-11-17
  • 更新时间: 2008-08-22

RSS订阅

Open Toolbar