'将所有的addins与当前test相关联
Dim arr1() As String = {"ActiveX", "Visual Basic", "Web"}
Dim appQTP as New QuickTest.Application
appQTP.Launch()
appQTP.Visible = True
appQTP.Open("D:\test1")
If Not blnActivateOK Then ' If a problem occurs while loading the add-ins
MsgBox("Failed to add addins") ' Show a message containing the error
End If
appQTP.Quit()
appQTP = Nothing
[ 本帖最后由 bsbolg 于 2008-7-29 17:34 编辑 ]作者: 没有蛀牙 时间: 2008-7-29 17:23
这是帮助里面的例子:
'************************************************************************************************************************
'Description:
'
'This example replaces the Java Add-in with the Oracle Add-in in the
'associated add-ins list of the specified test.
'
'Assumptions:
'
'There is no unsaved test currently open in QuickTest.
'For more information, see the example for the Test.SaveAs method.
'************************************************************************************************************************
Dim qtApp ' As QuickTest.Application ' Declare the Application object variable
Directory = InputBox("Enter the path of the test you want to convert.")
Call ConvertTest(Directory)
Private Function ConvertTest(TestPath)
' Create the Application object
Set qtApp = CreateObject("QuickTest.Application")
' Open the test.
Call qtApp.Open(TestPath)
' Retrieve the list of the test's associated add-ins
Addins = qtApp.Test.GetAssociatedAddins()
' If Java appears in the retrieved list, replace it with Oracle.
For i = 0 To UBound(Addins)
If Addins(i) = "Java" Then
Addins(i) = "Oracle"
End If
Next
' Apply the new associated add-ins list to the test.
If Not qtApp.Test.SetAssociatedAddins(Addins, ErrorDesc) Then
MsgBox "Unable to modify the associated add-ins for this test: " _
& Chr(13) & TestPath _
& Chr(13) & ErrorDesc
Exit Function
End If
' If the change is successful, save the test.
Call qtApp.Test.Save
End Function
SetAssociatedAddins方法的参数应该是数组作者: bsbolg 时间: 2008-7-29 17:38
尝试过你代码,但依然报参数不正确的异常!谢谢!传入字符串数组,或者addins数组都不行。如果我使用VBSCRIPT可以通过,但VB.NET里面就报错。郁闷,帮助里面的相关例子都试过,没有成功的。不知原因何在