QTP之轻松写入html log

来源:互联网 发布:iphone7怎么关闭4g网络 编辑:程序博客网 时间:2024/06/08 04:24

       用QTP自动化的人都知道,报告时一个很重要的文件,也是检验测试是否通过的凭证,那么如何才能更好的写好log呢?今天我先开的头,可能要在后面才会更新这个模块内容;先给大家来个例子;

Function wrt_html(oStr)Dim FSO,oLogDim FileDir'文件路径'On Error Resume NextConst ForReading=1,ForWriting=2,ForAppending=8                 '参数赋值(1:只读,2:只写,3:追加)Set FSO = CreateObject("Scripting.FileSystemObject")'打开文件Set oLog = FSO.OpenTextFile("D:\测试.HTML", 8, True) oLog.WriteLine (CStr("oStr"))   '写入文件'关闭和释放oLog.CloseSet oLog = NothingSet FSO = NothingEnd Function

 以上代码是在D盘目录下面写HTML文件  调用办法为:call wrt_html("111") 然后html就会出现如图:

这个只是开始后面会教大家写如下的报告:涂上颜色、截图、超链接等等,敬请期待……

 

0 0
原创粉丝点击