VBS启动QTP

2012-06-22  张洪杰 

自动化学习笔记---VBS启动QTP

Dim qtApp 
Dim blnNeedChangeAddins 
Dim arrTestAddins
Dim m
Set qtApp = CreateObject("QuickTest.Application")
blnNeedChangeAddins = False 
If qtApp.Launched And blnNeedChangeAddins Then
qtApp.Quit 
End If
If blnNeedChangeAddins Then
Dim blnActivateOK
blnActivateOK = qtApp.SetActiveAddins(arrTestAddins, errorDescription) ' 加载与测试关联的加
If Not blnActivateOK Then ' 如果在加载加载项时发生问题
MsgBox errorDescription ' 显示包含错误的消息
WScript.Quit ' 并结束自动程序。
End If
End If
If Not qtApp.Launched Then 
qtApp.Launch 
End If
qtApp.Visible = True 

Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
Dim executeArray 
executeArray  = oTestCaseDict.keys
For  iCount = 0 to oTestCaseDict.Count -1 
keyName = executeArray(iCount)
Dim oArray
oArray = oTestCaseDict(keyName)
testcaseName = oArray(3)
qtApp.open testcaseName
set qtTest = qtApp.test
qtResultsOpt.ResultsLocation = RootDir & "QTPReport\" & keyName ' Set the results location
qtTest.Run qtResultsOpt
on error resume next 
Next
qtApp.Quit
Set qtApp = Nothing 
Set qtResultsOpt  = Nothing
377°/3773 人阅读/0 条评论 发表评论

登录 后发表评论