Archive for August, 2007
QTP METHODS AND PROPERTIES
1.Activate: Activates the current Dialog Box.
Syntax: object.Activate [BUTTON]
Example:
Sub Activate_Example()
‘The following example uses the Activate method to activate the
‘Internet Options dialog box.
Browser(“Mercury Tours”).Dialog(“Internet Options”).Activate
End Sub2. CaptureBitmap: Saves the screen capture of the object as a .png or .bmp image using the specified file name.
Syntax: object.CaptureBitmap FullFileName, [OverrideExisting]
Example:
Sub CaptureBitmap_Example1()
‘The following example uses the CaptureBitmap method to capture a
’screen shot of the Internet Options dialog box. The file is
‘automatically saved to a different folder (the test run results
‘folder) in each run.
Browser(“Mercury Tours”).Dialog(“Internet Options”).CaptureBitmap “internet_options.bmp”
End Sub
3. ChildObjects: Returns the collection of child objects contained within the object.
Syntax: object.ChildObjects (pDescription)
Example:
‘The following example uses the ChildObjects method to retrieve a
’set of child objects matching the description listed in the function
‘call and uses the method to display a message indicating how many
‘objects are found with the specified description: none, one (unique),
‘or several (not unique).
Public Function CheckObjectDesription(parent, descr)
Dim oDesc
‘ Create description object
Set oDesc = Description.Create()
arProps = Split(descr, “,”)
For i = 0 To UBound(arProps)
arProp = Split(arProps(i), “:=”)
If UBound(arProp) = 1 Then
PropName = Trim(arProp(0))
PropValue = arProp(1)
oDesc(PropName).Value = PropValue
End If
Next
‘ Get all child objects with the given description
Set children = parent.ChildObjects(oDesc)
If children.Count = 1 Then
CheckObjectDesription = “Object Unique”
ElseIf children.Count = 0 Then
CheckObjectDesription = “Object Not Found”
Else
CheckObjectDesription = “Object Not Unique”
End If
End Function
4. Click: Clicks on a object.
Syntax: object.Click [X], [Y], [BUTTON]
Example:
Sub Click_Example()
‘The following example uses the Click method to click a right mouse
‘button at coordinates 47, 131 on the Internet Options dialog box.
Browser(“Mercury Tours”).Dialog(“Internet Options”).Click 47, 131, 1
End Sub
5. Close: Closes the Dialog Box.
Syntax: object.Close
Example:
Sub Close_Example()
‘The following example uses the Close method to close the Internet
‘Options dialog box.
Browser(“Mercury Tours”).Dialog(“Internet Options”).Close
End Sub
6. DblClick: Double clicks on a object.
Syntax: object.DblClick X, Y, [BUTTON]
Example:
Sub DblClick_Example()
‘The following example uses the DblClick method to double-click a right
‘mouse button at coordinates 73, 120 on the SysListView32 object.
Window(“Exploring”).WinListView(“SysListView32″).DblClick 73, 120, 1
End Sub
7. Drag: Performs the ‘drag’ part of a drag and drop operation.
Syntax: object.Drag X, Y, [BUTTON]
Example:
Sub Drag_Example1()
‘The following example uses the Drag and Drop methods to drag the object from
‘coordinates 10, 20 within the Test window and drop the object at
‘coordinates 30, 40 within the same window.
Window(“Test”).Drag 10, 20
Window(“Test”).Drop 30, 40
End Sub
8. Drop: Performs the ‘drop’ part of a drag and drop operation.
Syntax: object.Drop X, Y, [BUTTON]
Example:
Sub Drop_Example1()
‘The following example uses the Drag and Drop methods to drag the object from
‘coordinates 10, 20 within the Test window and drop the object at
‘coordinates 30, 40 within the same window.
Window(“Test”).Drag 10, 20
Window(“Test”).Drop 30, 40
End Sub
9. Exist: Checks that an object exists.
Syntax: object.Exist([TimeOut])
Example:
Sub Exist_Example()
‘The following example uses the Exist method to determine the existence
‘of the Internet Options dialog box. If the dialog box exists a
‘message box appears confirming its appearance.
If Browser(“Mercury Tours”).Dialog(“Internet Options”).Exist Then
MsgBox (“The object exists.”)
End If
End Sub
10. GetRoProperty: Returns the current value of the test object property from the object in the application.
Syntax: object.GetROProperty (Property, [PropData])
Example:
Sub GetROProperty_Example()
‘The following example uses the GetROProperty method to retrieve the
‘x coordinate of the Test window.
x = Window(“Test”).GetROProperty(“x”)
y = Window(“Test”).GetROProperty(“y”)
End Sub
11. GetTextLocation: Checks whether the specified text string is contained in the specified window area.
Syntax: object.GetTextLocation (TextToFind, Left, Top, Right, Bottom, [MatchWholeWordOnly])
Example:
Sub GetTextLocation_Example()
‘The following example uses the GetTextLocation method to retrieve
‘all of the text within the object.
l = -1
t = -1
r = -1
b = -1
result = Dialog(“Dialog”).WinObject(“Date”).GetTextLocation(“2002″, l, t, r, b)
If result Then
MsgBox “Text found. Coordinates:” & l & “,” & t & “,” & r & “,” & b
End If
End Sub
12. GetToProperties: Returns the collection of properties and values used to identify the object.
Syntax: object.GetTOProperties
Example:
Sub GetTOProperties_Example1()
‘The following example uses the GetTOProperties method to retrieve the
‘list of properties and values used to identify the Internet Options
‘dialog box.
IEOptsDialog = Browser(“Mercury Tours”).Dialog(“Internet Options”).GetTOProperties()
End Sub
13. GetToProperty: Returns the value of a specified property from the test object description.
Syntax: object.GetTOProperty (Property)
Example:
Sub GetTOProperty_Example()
‘The following example uses the GetTOProperty method to retrieve the
‘RegExpWndClass property from the Object Repository.
Dim ObjectName
RegExpWndClass = Window(“Test”).GetTOProperty(“RegExpWndClass”)
End Sub
14. GetVisibleText: Returns the text from specified area.
Syntax: object.GetVisibleText ([Left], [Top], [Right], [Bottom])
Example:
Sub GetVisibleText_Example1()
‘The following example uses the GetVisibleText method to retrieve the
‘text from the Telnet window. If the returned string contains the “login:”
’sub-string, the Type method is used to type the guest string in the
‘window.
TelnetText = Window(“Telnet”).GetVisibleText
If InStr(1, TelnetText, “login:”, 1) > 0 Then
Window(“Telnet”).Type “guest”
End If
End Sub
15. MouseMove: Moves the mouse pointer to the designated position inside the activeXobject.
Syntax: object.MouseMove X, Y
Example:
Sub MouseMove_Example()
‘The following example uses the MouseMove method to move the mouse
‘pointer to the position (20, 30) inside the Advanced object.
Browser(“MyPage”).Dialog(“Settings”).WinObject(“Advanced”).MouseMove 20, 30
End Sub
16. Move: Moves the dialog box to the specified absolute location on the screen.
Syntax: object.Move X, Y
Example:
Sub Move_Example()
‘The following example uses the Move method to move the Internet
‘Options dialog box to the specified location.
Browser(“Mercury Tours”).Dialog(“Internet Options”).Move 659, 35
End Sub
17. Maximize: Maximize the dialog box to fill the entire screen.
Syntax: object.Maximize
Example:
Sub Maximize_Example()
‘The following example uses the Maximize method to maximize the
‘Internet Options dialog box.
Browser(“Mercury Tours”).Dialog(“Internet Options”).Maximize
End Sub
18. Minimize: Minimizes the dialog box to an icon.
Syntax: object.Minimize
Example:
Sub Minimize_Example()
‘The following example uses the Minimize method to minimize the
‘Internet Options dialog box.
Browser(“Mercury Tours”).Dialog(“Internet Options”).Minimize
End Sub
19. Resize: Resize the dialog box to the specified dimensions.
Syntax: object.Resize Width, Height
Example:
Sub Resize_Example()
‘The following example uses the Resize method to resize the Internet
‘Options dialog box.
Browser(“Mercury Tours”).Dialog(“Internet Options”).Resize 296, 348
End Sub
20. Restore: Restores the dialog box to its previous size.
Syntax: object.Restore
Example:
Sub Restore_Example()
‘The following example uses the Restore method to restore the
‘Internet Options dialog box to its previous size.
Browser(“Mercury Tours”).Dialog(“Internet Options”).Restore
End Sub
21. SetToProperty: Sets the value of the specified property in its test object description.
Syntax: object.SetTOProperty Property, Val
Example:
Sub SetTOProperty_Example()
‘The following example uses the SetTOProperty method to set the
‘index of a window’s description.
Window(“Test”).SetTOProperty “Index”, 2
End Sub
22. Type: Type the specified string in the dialog box.
Syntax: object.Type KeyboardInput
Example: Not Available
23. WaitProperty: Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step.
Syntax: object.WaitProperty (PropertyName, PropertyValue, [lTimeOut])
Example:
Sub WaitProperty_Example()
‘The following example uses the WaitProperty method to make the
‘program wait for the “Test” window to become active or for 3 seconds
‘(3 milliseconds) to pass, whichever comes first.
y = Window(“Test”).WaitProperty(“focused”, True, 3000)
End Sub
24. Output: Retrieves the current value of an item and stores it in a specified location.
Syntax: object.Output pVerify
Example:
Sub Output_Example()
‘The following example uses the Output method to output text into the
‘”You can change” Data Table column.
Browser(“index”).Dialog(“Internet Options”).Static(“You can change”).Output CheckPoint(“You can change”)
End Sub
QTP COMBO BOX PROPERTIES
1. GetContent: Returns a string containing the names of all of the items in the combo box.
Syntax: object.GetContent
Example:
Sub GetContent_Example ()
Add comment August 16, 2007
Difference between Smoke and Sanity Testing
There are two types of test types, Smoke and Sanity. What they are exactly? Here we go…..
The general definition (related to Hardware) of Smoke Testing is: Smoke testing is a safe harmless procedure of blowing smoke into parts of the sewer and drain lines to detect sources of unwanted leaks and sources of sewer odors.
It is related to s/w, the definition is Smoke testing is non-exhaustive software testing, ascertaining that the most crucial functions of a program work, but not bothering with finer details.
Sanity testing is a cursory testing; it is performed whenever a cursory testing is sufficient to prove the application is functioning according to specifications. This level of testing is a subset of regression testing. It normally includes a set of core tests of basic GUI functionality to demonstrate connectivity to the database, application servers, printers, etc.
Smoke Testing and Sanity Testing In greater details…
Smoke Test:
When a build is received, a smoke test is run to ascertain if the build is stable and it can be considered for further testing. Smoke testing can be done for testing the stability of any interim build. Smoke testing can be executed for platform qualification tests.
Sanity testing:
Once a new build is obtained with minor revisions, instead of doing a through regression, sanity is performed so as to ascertain the build has indeed rectified the issues and no further issue has been introduced by the fixes. Its generally a subset of regression testing and a group of test cases are executed that are related with the changes made to the app. Generally, when multiple cycles of testing are executed, sanity testing may be done during the later cycles after through regression cycles. Difference between Smoke Testing and Sanity Testing:
· Smoke testing originated in the hardware testing practice of turning on a new piece of hardware for the first time and considering it a success if it does not catch fire and smoke. In software industry, smoke testing is a shallow and wide approach whereby all areas of the application without getting into too deep, is tested.
A sanity test is a narrow regression test that focuses on one or a few areas of functionality. Sanity testing is usually narrow and deep.
· A smoke test is scripted–either using a written set of tests or an automated test
A sanity test is usually unscripted.
· A Smoke test is designed to touch every part of the application in a cursory way. It’s is shallow and wide.
A Sanity test is used to determine a small section of the application is still working after a minor change.
· Smoke testing will be conducted to ensure whether the most crucial functions of a program work, but not bothering with finer details. (Such as build verification).
Sanity testing is a cursory testing; it is performed whenever a cursory testing is sufficient to prove the application is functioning according to specifications. This level of testing is a subset of regression testing.
· Smoke testing is normal health check up to a build of an application before taking it to testing in depth.
Sanity testing is to verify whether requirements are met or not, checking all features breadth-first.
3 comments August 2, 2007