QTP之轻松写入html log_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:46:08
Original
981 people have browsed it

       用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
Copy after login

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

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

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!