Friday, September 5, 2014

Smart Identification Mechanism


Smart Identification:

Smart identification is a mechanism in QTP to identify Object smartly when object identification fails to identify the object due to changes in object properties.
Smart Identification uses two types of properties,

Base Filter Properties:

These are the most fundamental properties of an object whose values cannot be changed without changing the essence of the original object.

Optional Filter Properties:

Other properties that can help identify Objet.

If smart identification is invoked during test run, in the test results tree a warning message is generated indicating smart identification was invoked and a smart identification step is inserted.

HP UFT verus QTP


HP Unified Functional Testing (UFT) 11.5 is a combination of QTP (Quick Test Professional) and Service Test (ST) tools. Using UFT we can automate GUI, API and Mobile applications functionality.

HP UFT 11.5 New Features:

  • Updated IDE, which supports to work on multiple tests at the same time.
  •  HP UFT supports for editing more than one action at the same time.
  •  New Recording Mode Insight Recording for GUI Test, It enables us to record on any object(control) displayed on application screen, whether or not UFT supports object technology and is able to retrieve its properties or activate its methods.
  • New Checkpoint called File Content Checkpoint added in UFT 11.5, it is for checking File content
  •  New Output Value called File Content Output Value added in UFT 11.5, It is for capturing file content.
  • New GUI Testing support for Qt and Adobe Flex Applications.

Advantages of UFT over QTP:
  • QTP only for Functional and Regression Testing of GUI (Windows based and Web) Applications.
  • UFT is combination QTP and Service Tools, It supports GUI and API Testing.
  • UFT has brand New IDE
  • Image/Control based Test Recording
  • Extended Support for Mobile Testing, write agnostic scripts, which once written can be used on multiple devices and test our scripts on simulators as well as real devices. 

UFT User Interface:

QTP 11.0 has 10 menus whereas UFT 11.5 has 12 menus.

Added Menus:

Search, Design, Record, Run and ALM.

Removed Menus:

Insert, Automation, Debug




Exception/Error Handling using VB Script in QTP


Unexpected errors or events during test run which interrupt test are called Exceptions.

Exception/Error handling ways:

VB script error handling


o   Using Test Settings
o   Using On Error Statement
o   Using Err Object Properties
o   Using Exit Statement

·         Recovery Scenarios

Test settings: Error handling
Exception/Error handling can be defined in Test Settings through FileàSettingsàRun as shown below,




On Error Statement: Error handling

On error statement is used to handle the errors by the tester rather than allowing VB Script engine to display error messages.

On Error Resume Next:
Causes the execution to continue with next line of code when error is occurred.

On Error GoTo 0:
Disable error handling if you have previously enabled error handling using On Error Resume Next.

Err Object: Error Handling:

Err object contains information about run-time errors.
Err object is built in object with global scope.

Properties:

Number: Number is the default property of the Err Object and it contains numeric value specifying error.

If the value of Err. Number is 0, no error has occurred.

Description: Description property returns or sets a descriptive string associated with an error.
When the run-time error occurs, the properties of Err object are filled with information that uniquely identifies the error and information that can be used to handle it.

Methods:

Raise: To generate a run-time error in your code, use the Raise method.

Clear: The Clear method clears all property settings of the Err object.

 Using Exit Statement: Error Handling

Exit Statement can be used in conjunction with err object to exit from a test/action/iteration in case of an error encountered. Following are the exit statements that can be used in QTP to exit from a particular state:

ExitTest: Exits the entire QTP test or Quality Center business process test, regardless of the run-time iteration settings.

ExitAction: Exits the current action.

ExitActionIteration: Exits the current iteration of the action.  

ExitTestIteration:  Exits the current iteration of the QTP test or Quality Center business process test and proceeds to the next iteration.

 










Thursday, August 14, 2014

UFT 12 - Troubleshooting and Limitations of Mozilla Firefox

General Limitations :

·         If two minor versions of Mozilla Firefox are installed on the same computer, and the earlier version was installed after the later version, UFT may not recognize which is the latest version.
·         UFT does not support anonymous content elements in non-XUL frames. (For example, the buttons in the Mozilla Firefox SSL exception page.)

Recording :

·         Recording on Mozilla Firefox pages is only possible when the page is fully loaded.
·         When recording steps in Mozilla Firefox, additional steps may be recorded.
Workaround: Manually remove the extraneous steps after the recording session ends.
·         When recording on some Mozilla Firefox versions, if you perform a search on google.com by entering the search string and then pressing Enter, the Submit operation is not recorded. Subsequently, when you run the test, UFT enters the search string but does not perform the search.
Workaround: Do one of the following:
    • When recording the search operation, click the search button instead of pressing Enter.
    • Manually add the Submit (or Click) step to the test or component.
·         The If Handler option in the Web Event Recording Configuration Dialog box works on Mozilla Firefox browsers only if the handler is assigned as an attribute (for example, <A onclick = "some code"/>) and not if it is assigned as a property (for example, aObj.onclick = function() {some code})

Test Objects, Methods, Properties, and Checkpoints :

·         UFT does not support accessing browser dialog boxes (such as alert, confirmation, or prompt) directly in Mozilla Firefox.
Workarounds for Firefox only:
o    Use the HandleDialog or GetDialogText methods described in the Web section of the HP UFT Object Model Reference for GUI Testing.
o    If the Browser("xxx").Dialog("xxx").Page("xxx") object is recognized, either use a recovery scenario with the HandleDialog method, or a Browser("xxx").Dialog("xxx").Page("xxx").Type step to handle the pop-up dialog box. For example, use an Enter key to click the default button and close the dialog box.
·         The Object Spy and Checkpoint Properties dialog boxes do not retrieve the current value of edit boxes in Mozilla Firefox dialog boxes.
·         The Object Spy and Navigate and Learn dialog boxes do not retrieve the current value of tabmodal dialogs in Mozilla Firefox.
·         The Type property of the WebButton test object has a different default value in Microsoft Internet Explorer and Mozilla Firefox. In Microsoft Internet Explorer the default value is Button, but in Mozilla Firefox the default value is Submit.
Workaround: Do not use the Type property in the description of a WebButton test object.
·         When using Mozilla Firefox, the innertext, outertext, innerhtml and outerhtml property values may differ from other browsers. Therefore, using these values in parameters or running checkpoints that use these property values may cause the steps to fail.
·         The following test objects, methods, and other Web-specific functionalities are not supported in Firefox:
o    ViewLink test object
o    WebXML test object (and, accordingly, XML checkpoints and output value steps)
o    Browser.Object method
·         Text area checkpoints are not supported on Mozilla Firefox.
·         If you drag a tab to create a separate window in Firefox, UFT stops recognizing, recording, or running any web objects in the new window.

Web 2.0 Support :

·         Due to synchronization issues, if you navigate to a new Web page in Firefox while recording, then UFT may not record certain operations on certain ASP.NET Ajax or jQuery UI objects in the page. Similarly, when running steps that navigate to a new page, UFT may fail to perform certain steps on certain ASP.NET Ajax or jQuery UI objects.

Workaround: If the problem occurs while recording, refresh the Web page and record the step again. If the problem occurs while running, insert a Wait() statement before the problematic step.

UFT 12-Working With Google Chrome

By default, the ability to run extensions on local HTML files is disabled in Google Chrome. Do the following to allow the UFT Google Chrome extension to run on local HTML files:

1.      In Google Chrome, browse to the following URL: chrome://extensions

2.      Locate the UFT extension, named Unified Functional Testing Agent.

3.      Click the arrow located to the left of the icon to expand details about the extension.


Select Allow access to file URLs. Your selection is automatically saved.

Troubleshooting and Limitations - Google Chrome

Functionality and Settings
  • Web pages that modify the browser's JavaScript functionality (for example, a Web page that replaces the JSON object) may cause UFT to behave unexpectedly.
  • The font and color properties for link objects contain different values in different browsers. Therefore, if you create standard checkpoints in Microsoft Internet Explorer and select the font and color properties, running these checkpoints in Chrome or Safari may cause the checkpoints to fail.
  • If you have multiple Chrome or Safari users defined, you must delete all users.
Test Objects, Methods and Properties
  • When using Chrome or Safari, the innertext, outertext, innerhtml and outerhtml property values may differ from other browsers. Therefore, using these values in parameters or running checkpoints that use these property values may cause the steps to fail.
  • The following test objects, methods, and other Web-specific functionalities are not supported in Chrome or Safari:
    • ViewLink test object
    • chrome://* pages
    • Browser.Home method
    • Browser.FullScreen method
    • Browser.ClearCache method
    • Browser.Object method
    • Developer Tools pane. (Running steps on Chrome or Safari while the Developer Tools pane is open is supported.)
    • Web pages that include frame sets.
    • Web test objects located inside iFrame controls with a blank or about:blankSRC identification property value.
    • WebXML test object (and, accordingly, XML checkpoints and output value steps).
    • Web 2.0 test objects or Web Add-in Extensibility-based test objects.
    • Web-based environments, such as Web-based SAP, Siebel, Java, .NET Web Forms, and so on.

Wednesday, July 2, 2014

Fetching Database Records using QTP

How to retrieve data from database using scripts

We can use ADODB.Recordset to get the recordset object.
Set  MyRecordSet=CreateObject(“ADODB.Recordset”)

Properties and Methods of Recordset object:

The properties and methods of Recordset object are veryuseful in getting the database records.

Recordset Properties:

RecordSet Properties
Description
AbsolutePage
Page of current position
AbsolutePosition
Current position
ActiveConnection
Active Connection Object
BOF
Beginning of File
Bookmark
Bookmark of current position
CacheSize
Number of records cached
CursorLocation
Server or Client
CursorType
Forward, Static, Dynamic, Keyset
EOF
End of File
EditMode
Whether or not an edit is in progress
Filter
What kind of records to hide
LockType
Record lock type for edits or updates
MaxRecords
Maximum number of records to retrieve
PageCount
Total number of pages
PageSize
Number of records per page
RecordCount
Total number of records
Source
Source Command Object
Status
Status of last action



Recordset Methods:

Recordset Methods
Description
AddNew
Add a new record to the RecordSet
CancelBatch
Cancel pending batch updates
CancelUpdate
Cancel pending update
Clone
Copy the RecordSet
Close
Close the RecordSet
Delete
Delete current record
GetRows
Retrieve multiple records
Move
Move the record pointer to a specific record
MoveNext
Move the record pointer to the next record
MovePrevious
Move the record pointer to the previous record
MoveFirst
Move the record pointer to the first record
MoveLast
move the record pointer to the last record
NextRecordSet
Load the next RecordSet in a multi-set query
Open
Open the RecordSet (execute the query)
Requery
Re-execute the last query executed
Resync
Synchronize the data with the server
Supports
Determine if a feature is supported by provider
Update
Update the current record
UpdateBatch
Update pending batched record updates