Option Explicit
'*****************************************************************
'??????????????????????·???????????????
'*****************************************************************
Dim ReportLocation '??????·??
ReportLocation = "D:projectQTPqtpscript"
Dim QtpLocation 'Qtp???·??
QtpLocation = "D:softwaretestingMercury InteractiveQuickTest ProfessionalinQTPro.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:projectQTPqtpscript arTest"?? True??ReportLocation
'oMTM.AddTestScript. "D:projectQTPqtpscript arTest"?? True??ReportLocation ?????????????
' ???н??
oMTM.Run
while ( oMTM.IsRunning )
Wend
oMTM.Quit
Set RunSettings = Nothing
Set ReportSettings = Nothing
Set MTM = Nothing