Featured

0 QTP Naming Conventions


Checkbox = chk   
Dialog Box = dbDisplay = displ                                                         
Icon = icLabel = lbl
Links = linkList Box = lb                                                            
List View = lvLogo = logo     
Menu = mMenu Item = mi                                                       
Message Box = mbPopup List = poplst  
Push Button = pbRadio Button = rb                                                   
Scroll Bar = sbStatic Text = stxt                                                     
Status Bar = stbrTab = tab                                                                
Table = tblText Box = txt                                                        
Tool Bar = tbTree View = tv                                                      
Header = hdrPanel = pan                                                              
Status Window = stwinSplitter = sp                                                            
Container = ctnNavigation bar = nb                                                
Grid = grdCombo box = cbx                                                    
Window = win         

Test Scripts

 The test scripts name
  • Must consist of alphabets, numbers and ‘_’.
  • Must start with an upper case letter.
  • If more than one word is used, the starting of every word must be in Upper case.      (Eg: Test_Script)
  • Name of the script must be in the format – Application/Test group, Feature/Action Number (XYZ_01).

VBS Files

  • A  VBScript file name must consist of alphabets.
  • Name should preferably be in the format Project_Module_Function

Functions

  • Must consist of alphabets.
  • Must start with ‘func’.
  • Name must stand for the functionality of the function.
  • If more than one word is used, the starting of every word should be in capitals.
  • Numerical are not allowed in the names
          Eg:  Public function funcOpenWindow (in window_name) 

 Constants and Variables

  • Name of a constant must be in upper case letters with underscores in it.  Eg: public const OR_PATH_DIR= c:\\mytests\\Action1; 
  • Name of a variable must be of lowercase letters and can contain underscores and digits. Eg: public my_variable_name=”This is my variable”;
·        Declare all the variables using DIM.

Object Repository

  • Object repository file name must consist of alphabets and should be like project_Module_Function.tsr.
  • If the name of an object or window is ambiguous, then it must be renamed in the format ObjectType_Label. Eg: Button_Done, Window_EngagementSummry, Checkbox_Overage, Radio_Awarded etc.
  • If more than one word is used, the starting of every word should be in capitals.

Recovery Manager

  • Name of a Recovery Manager file must be of alphabets and if necessary digits.
  • The files must be of the format Project_Module_Function_in.qrs.
Read more

4 Running QTP Script through vbs file

Public Sub ExecuteTest(TestPath)

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible

' Set QuickTest run options
qtApp.Options.Run.ImageCaptureForTestResults = "OnError"
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = True

'This will Open a script
qtApp.Open TestPath , True ' Open the test in read-only mode


' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Settings.Run.IterationMode = "rngIterations" ' Run only iterations 2 to 4
qtTest.Settings.Run.StartIteration = 1
qtTest.Settings.Run.EndIteration = 1
qtTest.Settings.Run.OnError = "NextStep" ' Instruct QuickTest to perform next step when error occurs

'For Viewing Results
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtResultsOpt.ResultsLocation = "C:\Telecom Automation Scripts\Res1" ' Set the results location
qtTest.Run qtResultsOpt ' Run the test
qtApp.Options.Run.ViewResults = True

'Close QTP
'qtTest.Close ' Close the test

'Set the options to nothing
Set qtResultsOpt = Nothing ' Release the Run Results Options object
Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object

End Sub
Read more

0 Right click simulation in DP

Simulating a right click to open a link in a new window does not require descriptive programming.

Here is the code:
url = Browser("IT Resource Center forums_2").Page("IT Resource Center forums").Link("Henry Floyd").GetROProperty("url")

SystemUtil.Run "C:\Program Files\Internet Explorer\IEXPLORE.EXE",url,"","open"


Method :2 

    object.FireEvent "oncontextmenu"
Read more

5 QTP 10 patch for Windows 7 and IE8


Just few months back (7th/Dec), HP announced the support for Windows 7 and WindowsServer 2008 R2 for QTP10.

Download  QTP 10 patch 00644 for Windows 7
Download  QTP 10 patch 00037 for Windows 7 - Support for Internet Explorer 8

Also find more patches...



Both patches to support IE8.0 (qtpweb_00037.exe) Windows 7.0(qtp_00644.exe) need to be installed for QTP10.0

You might need to check your UAC settings on windows 7.0 for recognizing Web objects.
Try the below settings:
1)IE: Select the “Enable 3rd party extensions” option under Tools –> Advanced section in IE
2)Open Control Panel, choose User Accounts and Family Safety >> System and Security Settings>>Change User Account Control settings>>Set the control to ‘Never notify’ and restart the computer.
You should now be able to use QTP10.0 on Windows 7 with IE8.
Read more

0 HP QuickTest Pro Patches

Read more

0 Screen capture when checkpoints fail

'=======This code minimizes the QTP
sTitleMask = "QuickTest Professional - .*"
 Window("regexpwndtitle:=" & sTitleMask).Minimize

'=======Checkpoint code
chk_txt_Acc=Browser("Xyz::Xyz").Page("Xyz::Xyz").Check(CheckPoint("Xyz::Xyz"))



If chk_txt_Acc=false Then
    Browser("Xyz::Xyz").Page("Xyz::Xyz").CaptureBitmap "c:\z_scrn_cap_Accounts.bmp",True
    Msgbox "Screen Captured!"
End If
Read more

0 How to Close QTP after execution


Private Function CloseQTP        
    Set objWMIService = GetObject(“winmgmts:\\.\root\CIMV2″)     
       Set colProcess = objWMIService.ExecQuery (“Select * from Win32_Process Where Name = ‘QTPro.exe’”)     
       For Each objProcess in colProcess                      
  objProcess.Terminate()           
 Next          
  Set objWMIService = Nothing         
   Set colProcess = NothingEnd FunctionCall CloseQTP
  Source: Mercury Forum’s KB articles
Read more

0 Reporter Object in QTP

This object is to send the information to the Test results.
  • Reports the status of test results ( pass, fail, warning)
  • Enable/Disable reporting of step(s) following the statement.
  • Retrieve the folder path in which the current test's results are stored.
  • Retrieve the run status at the current point of the run session.
Methods and Properties
ReporterEvent Method

syntax : Reporter.ReportEvent EventStatus, ReportStepName, Details

where EventStatus can be:
0 or micPass: If this step runs test passes which is shown in test report.

1 or micFail: If this step runs test fails which is shown in test report.

2 or micDone: Used to send message to the test report and does not affect status of test.

3 or micWarning: Again, used to send warning message to the test report and does not affect status of test.
and
ReportStepName is name of step
and
Details are the user defined details for the given step.


Filter property
RunStatus Property

Read more

1 WPF and WCF application testing in QTP

WCF : Windows Communication Foundation
QTP cannot be used for testing WCF services using NetTcpBinding. They should be using plain BasicHttpBinding for it to work.

WPF : Windows Presentation Foundation
QTP has the WPF addin but even after adding it, QTP seems to give only limited support.
Read more

0 QTP 10 on Windows Vista - Web objects problem

Problem :
QTP 10 is not recognizing any of the web objects in Windows Vista

Solution :
Task 1
Windows->Start->Control Panel->User Accounts->Turn User Account Control on or off,


















UNCHECK the check box "Use User Account Control (UAC) to help protect your computer.















Task 2
Open QTP
Check only the 'Web' Add-in and click OK.
Read more

0 Test Automation Framework

A framework is a standard for settings and procedures a a task that is more flexible for development and maintenance in future.

This is also for any professional to understand the system better and easy for him to work on development and maintenance.

For instance, you will have the 'Startup', 'Driver', 'Data' and the 'Result' scripts are the basic parts of the framework.

There are some types of Test Automation Framework like,
Key Word Driven
Data-driven
Modularity-driven
Hybrid
Read more

0 Open IE from QTP

Public Function IE_Open(url)
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate url
IE.Visible = True
End Function
Read more

1 Close all IE browsers

'// This will close all IE browsers
Public Function closeAllBrowsers
Dim oDesc, x

'Create a description object
Set oDesc = Description.Create
oDesc( "micclass" ).Value = "Browser"

'Loop through the collection and close each browser
If Desktop.ChildObjects(oDesc).Count > 0 Then
For x = 0 to Desktop.ChildObjects(oDesc).Count - 1
Browser( "creationtime:=" & x ).Close
Next
End If
End Function
Read more

0 Reading from an EXCEL file in QTP - VBScript

Pre-requisite : Have an excel file names c:\data.xls with data in 3 rows and 3 columns, remember to close the excel file before running the script.

QTP Code to read an excel file

Dim arr() ' Declares the array arr

zRead_frm_Excel "c:\data.xls","Sheet1",1

For i=0 to ubound(arr)-1
msgbox arr(i)
next


' This function is to read and close the xl | arg1=path of xl, arg2=sheet name, arg3=startn row
Function zRead_frm_Excel(xl,sheet,srt_row)

Set xlApp = GetObject("","Excel.Application")
xlApp.visible = true
Set xlWrkbk = xlApp.Workbooks.Open(xl)
Set xlWrksht = xlWrkbk.Worksheets(sheet) ' Data is the name of the sheet
intStartRow = srt_row ' Row from whcih you need to start
row_cnt= xlWrksht.UsedRange.Rows.Count
ReDim arr(row_cnt)
ub= ubound(arr)-1
i=0
For intRow = intStartRow to xlWrksht.UsedRange.Rows.Count
strAccountNumber = Trim(xlWrksht.Range("A" & intRow)) ' Column A
strAccuntName = Trim(xlWrksht.Range("B" & intRow)) ' Column B
dtDate = Trim(xlWrksht.Range("C" & intRow)) ' Column C
arr_value=strAccountNumber&strAccuntName&dtDate
arr(i)=arr_value
i=i+1
Next
xlApp.Quit
Set xlApp = Nothing
zRead_frm_Excel=arr

End Function
Read more
  • Recent Posts

     
    © QTPCode | Design by Blog template in collaboration with Concert Tickets, and Menopause symptoms
    Powered by Blogger