'此函数用于加载指定Test所有的插件,若要运行Test可自己加个qtApp.Test.Run
Function Load_Addins(testPath)
Dim qtApp 'As QuickTest.Application
Dim blnNeedChangeAddins
Dim arrTestAddins
Set qtApp = CreateObject("QuickTest.Application")
arrTestAddins = qtApp.GetAssociatedAddinsForTest(testPath)
blnNeedChangeAddins = False
For Each testAddin In arrTestAddins
If qtApp.Addins(testAddin).Status <> "Active" Then
blnNeedChangeAddins = True
Exit For
End If
Next
If qtApp.Launched And blnNeedChangeAddins Then
qtApp.Quit
End If
If blnNeedChangeAddins Then
Dim blnActivateOK
blnActivateOK = qtApp.SetActiveAddins(arrTestAddins, errorDescription)
If Not blnActivateOK Then
Call ErrorLog(errorDescription) '这里是调用自己的日志函数,可替换为自己的或注释掉
WScript.Quit
End If
End If
If Not qtApp.Launched Then
qtApp.Launch
End If
qtApp.Visible = True
qtApp.Open testPath
'可在此加入qtApp.Test.Run来运行Test
Set qtApp = Nothing
End Function