How can you add add-in's during runtime in QTP

Showing Answers 1 - 3 of 3 Answers

Kumar L S

  • Dec 13th, 2006
 

Hi.

We cannot add add-ins during runtime.

Thanks,

Kumar L S

  Was this answer useful?  Yes

RAJAGOPAL REDDY

  • Dec 14th, 2006
 

YES, You can add addins thru script runtime
Please see the following program, that lods the addins runtime.
This process explained in QTP Object model reference.
-Rajagopal Reddy


'****************************************************
'Description:
'
'This example opens a test and loads all the add-ins associated with the 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
Dim blnNeedChangeAddins ' Declare a flag for indicating whether the test's
associated add-ins are currently loaded
Dim arrTestAddins ' Declare the variable for storing the test's associated
add-ins


Set qtApp = CreateObject("QuickTest.Application") ' Create the Application
object


arrTestAddins = qtApp.GetAssociatedAddinsForTest("C:TestsTest1") ' Create an
array containing the list of addins associated with this test


' Check if all required add-ins are all already loaded
blnNeedChangeAddins = False ' Assume no change is necessary
For Each testAddin In arrTestAddins ' Iterate over the test's associated add-ins
list
If qtApp.Addins(testAddin).Status <> "Active" Then ' If an associated add-in is
not loaded
blnNeedChangeAddins = True ' Indicate that a change in the loaded add-ins is
necessary
Exit For ' Exit the loop
End If
Next


If qtApp.Launched And blnNeedChangeAddins Then
qtApp.Quit ' If a change is necessary, exit QuickTest to modify the loaded
add-ins
End If


If blnNeedChangeAddins Then
Dim blnActivateOK
blnActivateOK = qtApp.SetActiveAddins(arrTestAddins, errorDescription) ' Load
the add-ins associated with the test and check whether they load successfully.
If Not blnActivateOK Then ' If a problem occurs while loading the add-ins
MsgBox errorDescription ' Show a message containing the error
WScript.Quit ' And end the automation program.
End If
End If


If Not qtApp.Launched Then ' If QuickTest is not yet open
qtApp.Launch ' Start QuickTest (with the correct add-ins loaded)
End If
qtApp.Visible = True ' Make the QuickTest application visible


qtApp.Open "C:TestsTest1" ' Open the test
Set qtApp = Nothing ' Release the Application object


  Was this answer useful?  Yes

what do u mean by running add ins during a TEST...u mean running excel or MS word application during running a test ? sorry i just started learning QTP so i m not clear about the concepts and this question 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.