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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

in data driven testing for performing operations which method is easy from manual test data,keyword view,or from database.and why?

1348


How many ways we can parameterize data in quicktest professional (qtp)?

579


what is Property......End Property loop? how to write sript for it in QTP

1880


iam have done mba(finance)in 2008. in 2008 one reputed consultancy came off campus interview our institution. i got job as "manual test engineer". now iam working as "manual testing engineer". now my problem is when iam going interview the interviewer asking like " ur mba gradute how can u get job in test engineer." this question i have faced every interview. iam explaining how iam getting job. but they are not trust me". pls tell me answer how i am giving relavent ans.. this is my mail id y.ramana84@gmail.com

1390


What is recovery scenario manager? When you go for recovery scenario manager? Tell me one scenario were your used recovery scenario in your project?

564






tell me abt a time when u had to go above &beyind the call of duty to get the job done

1430


How to handle dynamic objects in quicktest professional (qtp)?

542


In qtp, how you can get the last character from a string?

546


What are metrics and matrix?

1356


Tell me about your project? please help me how to tell about insurance project

1517


Hi, I have 2 dropdown listboxes called region and city/area. It needs to select one region(Santa Clara) and one city/Area (Sunnyvale).So I put this in the for loop and I am storing the Items in the variable called itemname. The regions value will get changed,so I used reg expression for this regions. This is my code Browser("MLSListings.com").Page("MLSListings.com").Link("ยป County/Area").Click Browser("MLSListings.com").Page("MLSListings.com").WebList ("regions").Check CheckPoint("regions") ListSize=Browser("MLSListings.com").Page ("MLSListings.com").WebList("regions").GetTOProperty("items count") For i = 1 To ListSize-1 Itemname =Browser("MLSListings.com").Page ("MLSListings.com").WebList("regions").GetItem(i+1) Browser("MLSListings.com").Page("MLSListings.com").WebList ("regions").Select Itemname ................. If I run the script,I am getting the following error, Cannot identify the specified item of the regions object. Confirm that the specified item is included in the object's item collection. Any Help? Thank you, Uma

1336


Where is the resultset of a sqlquery (which is fired by rsobj.open sqlquery,xxxx,xxxx) stored ?

1855


How qtp recognizes the object?

661


HOW AUTOMATE TEST SCRIPT ? what time it will do? after gneration of basic script or Any , Plz explain detailed?

1707


what is clean sweep?

1873