不能因为路不好走,就忘了为什么出发。

QTP生成日志

上一篇 / 下一篇  2014-07-28 15:32:24 / 个人分类:自动化测试


Function WriteLog_WebEdit_Set(Object,SetValue)
   Object.Set SetValue
   Const ForAppending=8
   Const ForReading=1
   Const ForWriting=2

   '创建FSO对象
Set fso=CreateObject("scripting.filesystemobject")
'创建一个TXT文件,并返回一个TextStream对象,设为读取模式
LogFileName=cstr(year(now)&Month(now)&day(Now))+".txt"
oParentFolder=Environment.Value ("ResultDir")
print  oParentFolder
LogFilePath=oParentFolder+"\"+LogFileName
'判断日志文件是否存在
If NOT fso.FileExists(LogFilePath) Then
Set txtfile=fso.CreateTextFile(LogFilePath,False)
Else 
Set txtfile=fso.OpenTextFile(LogFilePath,ForAppending,True)
End If
'等待日志内容写入

WriteConent=cstr(Time)+" Object:["+Object.GetTOProperty("micClass")+"-"+Object.GetTOProperty("TestObjName")+_
"] - Description:"+"“Set Value is <"+SetValue+">"+"”"
txtfile.WriteLine WriteConent
Set txtfile=Nothing
Set fso=Nothing
End Function

TAG:

 

评分:0

我来说两句

yinjiajia0626

yinjiajia0626

学而不倦

日历

« 2024-04-28  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 4167
  • 日志数: 7
  • 建立时间: 2014-07-19
  • 更新时间: 2014-08-25

RSS订阅

Open Toolbar