QTP批量执行并发邮件

发表于:2014-4-09 11:20

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:芯树    来源:51Testing软件测试网采编

Option Explicit
'*****************************************************************
'脚本说明:公共变量声明,路径根据实际环境修改
'*****************************************************************
Dim ReportLocation '报告存放路径
ReportLocation = "D:\project\QTP\qtpscript\"
Dim QtpLocation 'Qtp安装路径
QtpLocation = "D:\softwaretesting\Mercury Interactive\QuickTest Professional\bin\QTPro.exe"
'*****************************************************************
'脚本说明:启动QTP
'*****************************************************************
Dim WshShell,oExec
set WshShell = WScript.CreateObject("WScript.Shell")
Set Exec = WshShell.Exec (QtpLocation)
Set WshShell = Nothing
WScript.Sleep 60000 '等待1分钟
'*****************************************************************
'脚本说明:判断文件是否存在,存在删除
'*****************************************************************
Dim oFSO
' 创建一个文件系统对象
set FSO = CreateObject ("Scripting.FileSystemObject")
CheckFileExists(ReportLocation)
Function CheckFileExists (FilePath)
FilePath = FilePath &"测试结果1.html"
' 检查文件是否存在,如果存在删除
CheckFileExists = oFSO.FileExists(FilePath)
'MsgBox CheckFileExists
If (CheckFileExists = true) Then
oFSO.DeleteFile (FilePath)
End if
End Function
'*****************************************************************
'脚本说明:批量执行脚本并生成摘要报告
'*****************************************************************
Dim oMTM
' 创建 Multi Test Manager 对象
Set MTM = CreateObject("MultiTestManager.Application")
oMTM.Visible = True
' 修改运行时的默认设置
Dim oRunSettings
Set RunSettings = oMTM.Preferences.RunSettings
oRunSettings.Iterations = 1
oRunSettings.CloseQuickTest = True
'打开注释启用定时调度
'oRunSettings.ScheduleRun = True
'oRunSettings.Day = 3
'oRunSettings.Month = 12
'oRunSettings.Year = 2009
'oRunSettings.Second = 00
'oRunSettings.Minute = 55
'oRunSettings.Hour = 15
' 修改报告的默认设置
Dim oReportSettings
Set ReportSettings = oMTM.Preferences.ReportSettings
oReportSettings.CreateReport = True
oReportSettings.OverwriteReport = False
oReportSettings.DefaultLocation = False
oReportSettings.ReportLocation = ReportLocation '报告存放路径
oReportSettings.ReportName = "测试结果"
oReportSettings.ViewReport = True
'批量执行脚本:脚本的目录,是否执行,执行结果存放位置
oMTM.AddTestScript. "D:\project\QTP\qtpscript\rarTest", True,ReportLocation
'oMTM.AddTestScript. "D:\project\QTP\qtpscript\rarTest", True,ReportLocation 根据脚本进行添加
' 运行脚本
oMTM.Run
while ( oMTM.IsRunning )
Wend
oMTM.Quit
Set RunSettings = Nothing
Set ReportSettings = Nothing
Set MTM = Nothing
21/212>
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号