QTP中错误处理(大林版)

上一篇 / 下一篇  2008-08-29 16:32:59 / 个人分类:QTP

On error resume next

datatable.GlobalSheet.DeleteParameter "num" '实际Global表中没有num这个字段,运行时会报错.

If err.number <> 0 Then
 createlog "C:\error.txt","Error",err.descrīption
End If

Function createlog(filepath,logtype,logdetail)

'该脚本用于输出LOG

FilePath = filepath  'LOG文件的路径
LOGType = logtype  'LOG的类型
LOGDetail = logdetail  'LOG的内容

Set fso = CreateObject("scrīpting.FileSystemObject")

'判断LOG文件是否存在,如不存在,则按指定路径新建

If fso.FileExists(FilePath) = False  Then

          Set LOGFile = fso.CreateTextFile(FilePath, True)

          LOGFile.Close

end if


        Set LOGFile = fso.OpenTextFile(FilePath, 8, True)  '8为追加

        LOGFile.WriteLine("")

        LOGFile.WriteLine(" ---------------------------------------------------------")

  LOGFile.WriteLine(" Time:" & Cstr(Now))

        LOGFile.WriteLine(" Type:" & LOGType )

        LOGFile.WriteLine(" Detail:" & LOGDetail)

        LOGFile.Close

  Set LOGFile = nothing
  Set fso = nothing
End Function


TAG: QTP

 

评分:0

我来说两句

我的栏目

日历

« 2024-05-21  
   1234
567891011
12131415161718
19202122232425
262728293031 

我的存档

数据统计

  • 访问量: 13061
  • 日志数: 14
  • 建立时间: 2008-08-05
  • 更新时间: 2008-08-30

RSS订阅

Open Toolbar