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
What are private functions in QTP? How they can be called from the function library?
Hi I know two types of testing processes. 1. Reaquirments stage,test design,code review's, Design review's, Test Plan, Test Cases design, test execution, Defect Reporting and tracking, UAT, Signoff. 2.Test Initiation , Test Plan, Test Design, Execution,Bug tracking, UAT, Sign off.
I am getting the "test object property" Description properties "toolkit class" value By using "gettoproperty" in run time But my problem is how to get Ordinal Identyfier's type and value Type is index, value is 0 How can i keep this values in to required place How can i get these values in runtime I have to insert these "index" and "value" into another area Is there any script for this like "gettoproperties","Getroproperties" If anybody knows,please help me .
I am a new tester that needs to create an automatic script involving security questions. On a webpage I need to select a security question(which are random) from a drop down menu, and then input the answer as the last word from the security question. I have the script set-up to automatically select the first security question from the drop down. The problem I am having is trying to insert the security answer. How do I insert the security answer based on the selection from the security question?
whow much strong on VB and C?
On what document base Descriptive programming is written if build is not yet ready ?
I opened gmail login into gmail and i have to save (Pass or move) all the mail into notepad please give me code Thanks of all
How does qtp identify gui object?
X flies from Hyd to bangalore using different methods of transportation. write the test scenarios and test cases for this?
How many add-ins comes by default with quicktest professional (qtp)?
What is CMMP and CMMH?
How do you create regression test packs?
You will receive the mail in your outlook from client at night time to go ahead for the execution. Based on the mail you need to trigger the batch run. What is the QTP Code for this?
In qtp, how you can use xpath to identify objects?
what are all the fileds present in object repository?