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
Why qtp always start action1 and does not start action?
If I give some thousand tests to execute in two days what do you do?
What is the default add-ins in qtp?
Hi, I got error message as "object does not support this property or method: "Test.Actions" when i execute the following line of script on QTP 9.0 Dim qtApp, qtRep Set qtApp = CreateObject("QuickTest.Application") Set qtRep = qtApp.Test.Actions("Action1").ObjectRepositories Can anyone tell me where i am wrong.
In the website, the protocol has been changed http: to https what you will do? Tell me your approach?
Hi, Can anyone please tell me how to connect the QC with QTP using QTP script? Thanks in advance
How extensive or customized are the server logging and reporting requirements; are they considered an integral part of the system and do they require testing?
If created one virtual object? Next time I changed the window position will it work?
What is debugging? How you debug your script?
I got some information from the QTP help.But i am not sure whether through this process will QTP work or not bellow is the Help what I have Remote setup Settings Remote WSH, which is a new technology included in WSH 5.6, provides the ability to run a script on a remote machine or machines. With Remote WSH, the script is physically copied from the local machine to the remote machine before executing. In order to enable Remote WSH functionality, you must first set up the remote machine with the proper security settings. The steps below perform the tasks that enable Remote WSH. Note Both the remote and local machines must be running Windows NT 4 SP3 or greater in order to use Remote WSH. To enable a machine to run remote scripts 1. Install WSH V5.6 on the machine. If you are using Windows 2001 or have installed Internet Explorer 6 or greater, WSH 5.6 has already been installed. Note WSH 5.6 is available for download from the web at http://msdn.microsoft.com/scripting 2. Add yourself to the remote machine's Local Administrators group. 3. To enable Remote WSH, use Poledit.exe on the server. Note An administrator who wants to enable Remote WSH must either acquire the Windows 2000 resource kit, or use http://msdn.microsoft.com/scripting to acquire the necessary windowsscript.adm file that contains the WSH settings. The windowsscript.adm file must be copied to the server that sets the gapplicabel group's policies. Although it is not necessary to copy the file to the server's \WINNT\INF directory, this is nonetheless where the default adm files are located. Note For more information on Poledit.exe, see the Poledit.exe's online help system. 4. WSH should now be enabled on the machine. To test it,. WSH 5.6 can run scripts that reside on remote systems. The following scripts demonstrate this capability. These scripts make the assumption that the files are located on a local machine directory called "c:\wsh5.6"; change the local path and the remote machine name as necessary. After initially running RemoteTest.WSF on the local machine, there may be a small pause as DCOM verifies your identity. After you see the "Done" message, a file named "c:\beenhere.txt" on the remote machine indicates the time that you executed the command (from the remote computer's clock). Script to run scripts remotely set oController = CreateObject("WSHController") set oProcess= oController.CreateScript("c:\wsh5.6\beenhere.wsf","remmachine") oProcess. Execute Could you tell me will it work fine
Hi,All How to create a link in excel sheet using qtp
How to do the scripting. Is there any inbuilt functions in qtp as in qtp-s. What's the difference between them? How to handle script issues?
What are the different recording modes?
hi i have completed my b.tech in cse stream. now i am working in an organisation in testing department. i want do sap course but i dnt know which module will boost my career can anyone suggest me which is good for my career
Can you list some technologies that support qtp?