how to load all resource files(function libraries,object
repositories etc) into tests without associating them?



how to load all resource files(function libraries,object repositories etc) into tests without asso..

Answer / sandeep

Use QTP object model for this purpose.

Create qtp.test object.

Under this object you will get several settings like
RECOVERY scenario, ADD IN, VBS functions etc.

Make a .vbs script of these settings
Open any QTP Script and then run this code.

QTP Script will have changed resource settings. See this
sample script which does similar task

Public Job_Name_Array1
Public Excel_file_path

Excel_file_path = "G:\DATA FOR GRAPHICS JOBS.xls"

DefineValue




Dim qtApp 'As QuickTest.Application ' Declare the
Application object variable
Set qtApp = CreateObject("QuickTest.Application") ' Create
the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = False ' Make the QuickTest application
visible
Dim qcfolderpath
qcfolderpath = "Subject\CAESAR II 5.00 QA PLAN\2 MAIN
MENU\2.1 STATIC\2.1.1 INPUT PROCESSOR\INPUT GRAPHICS
VIEW\Input Graphics QTP 9.5"

For nn = 0 To UBound (Job_Name_Array1,1)

'For nn = 2 To 1


'qtApp.Open "[QualityCenter] Subject\CAESAR II 5.00 QA
PLAN\QA JOBS WITH NEW FRAMEWORK\STATIC JOBS\BUILD CLEARANCE
WO FUNCTIONS\" & Job_Name_Array1 (nn), False ' Open the test

qtApp.Open "[QualityCenter] "& qcfolderpath & "\" &
Job_Name_Array1 (nn), False ' Open the test


For i=1 to qtApp.Test.Actions.Count
Set qtRepositories = qtApp.Test.Actions
(i).ObjectRepositories ' Get the object repositories
collection object of the "Login" action

qtRepositories.Removeall

Set qtRepositories = Nothing
Next




Set qtTestRecovery = qtApp.Test.Settings.Recovery ' Return
the Recovery object for the current test

If qtTestRecovery.Count > 0 Then ' If there are any default
scenarios specified for the test
qtTestRecovery.RemoveAll ' Remove them
End If



Set qtTestRecovery = Nothing ' Release the Recovery object

qtApp.Test.Save ' Save the test

Next


qtApp.Quit ' Exit QuickTest
Set qtApp = Nothing ' Release the Application object



Function DefineValue()

DIM objExcelApplication2
'DIM objWorkSheet
DIM Sheet2
DIM CellData2
Dim strExePath2
Dim strDrv2
Dim WshShell2
' strDrv2 = fnGetVirtualDrive()

'MsgBox strDrv
On Error Resume Next
Set objExcelApplication2 = CreateObject
("Excel.Application") '....Create Excel Object
If Err.Number <> 0 Then
Exit Function
End If

On Error Resume Next
' objExcelApplication2.Workbooks.open ("G:\DATA FOR
STATIC JOBS.xls")
objExcelApplication2.Workbooks.open (Excel_file_path)

If Err.Number <> 0 Then
MsgBox "Please ensure that you have run the
install.bat file before this run session"
Exit Function
End If

ReDim Job_Name_Array1 (0)

For xyz = 2 To 14

CellData2 = objExcelApplication2.Worksheets("Sheet1").Cells
(xyz,2).Value

Value1 = Trim (CellData2)

Job_Name_Array1(xyz-2) = Value1

ReDim Preserve Job_Name_Array1(xyz)

'MsgBox "JobName" &( xyz-2) & "is " & Job_Name_Array1
(xyz-2)

Next



objExcelApplication2.ActiveWorkbook.Close '....close the
work book
objExcelApplication2.Application.Quit '....quits
Excel

Set objExcelApplication2 = Nothing '....Clear all
the references to the objects
Set objWorkSheet2 = Nothing




End Function

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More QTP Interview Questions

Why qtp the best testing tool?

0 Answers  


HI ALL, HOW WE INSTALL .NET ADD-IN OR JAVA ADD-IN TO THE QTP? PLZ URGENT.ANSWER ME.

2 Answers  


What are the advantages of Automation objects than Test Objects?

2 Answers   Adobe,


How comfortable are you in VB scripting?

2 Answers  


In QTP, If you have list of checkboxes, how can i select a particular checkbox and delete if the checkboxes are changing dynamically?

0 Answers  






Hi, I Would Like to Know which is the Best QTP Certification Training Institute in Hyd? Thanks in Advance kishan

1 Answers  


On what document base Descriptive programming is written if build is not yet ready ?

0 Answers  


Diff b/w Test Design and Test case design? What is the Design Review's and Code Review's. When will you conduct tese reviews?

1 Answers  


How many types of recording facility are available in quicktest professional?

0 Answers  


hi to all, i need a code.. in flight application 1.i need to login first then i need to insert 3 new orders... 2.i have to log out 3.i have to login again with different user 4.need to insert 2 new orders 5.then need to log out 6.then again login with different user 7.3 new orders create and log out 8.but we hv to do this using data table and actions please help me

0 Answers  


What are the methods used in UFT to handle exceptions or run-time errors?

0 Answers  


what is the difference between parameters and arguments?

1 Answers  


Categories