标签:
用QTP自动化的人都知道,报告时一个很重要的文件,也是检验测试是否通过的凭证,那么如何才能更好的写好log呢?今天我先开的头,可能要在后面才会更新这个模块内容;先给大家来个例子;
Function wrt_html(oStr)
Dim FSO,oLog
Dim FileDir ‘文件路径
‘ On Error Resume Next
Const 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.Close
Set oLog = Nothing
Set FSO = Nothing
End Function
以上代码是在D盘目录下面写HTML文件 调用办法为:call wrt_html("111") 然后html就会出现如图:

这个只是开始后面会教大家写如下的报告:涂上颜色、截图、超链接等等,敬请期待……
标签:
原文地址:http://www.cnblogs.com/marcello/p/4501542.html