During this QTP guide, we’ll delve into Smart Object recognition, establishing a Synchronization point, conducting a test and analyzing the outcome, along with the Silent Test runner.
=> Click Here To Access The QTP Training Tutorials Series
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
Imagine a scenario where no object matches or more than one object matches the recorded description for an object at runtime. How does QTP manage it?
In this guide, you’re going to learn:
Smart Recognition
QTP is equipped with a mechanism to tackle such scenarios. If the recorded description cannot identify the specified object during a step, and if a smart identification definition for the object is described (and activated), then QTP tries to recognize the object using “Smart recognition”.
Let’s understand how this functions with a few examples. Every object possesses Primary Properties and Secondary properties.
Example 1: Object with the recorded description isn’t found.
On the page, there was a button offering these details:
- Primary: Name
- Secondary: Abs x, y
During recording, the “Name” property was “Login ID”. Due to changes in the application, the “Name” property has now been changed to “User ID”. In such a case, QTP would find a button with a different description and it should fail if it only considered the primary properties.
However, in instances such as this, when the primary properties don’t match, QTP checks the secondary properties. If they match, it recognizes the object. In this situation, it will identify the button based on its X and Y coordinates.
Example 2: QTP was supposed to locate a page X, but there are 2 pages with similar browser settings.
In this state, it uses the “name” or other characteristics to find the right page/pages and operates accordingly.
These two examples illustrate cases where QTP uses the Smart Recognition mechanism.
- The test results also reveal if the step used Smart recognition to operate successfully.
- If QTP can’t find the object despite Smart Recognition, then the test fails.
For most objects, QTP furnishes default base filter properties (Primary) and optional filter properties (Secondary) that it checks if we turn on Smart recognition for them. Users can also decide which properties to consider. To achieve this, navigate to “Tools -> Object Identification”.
Choose the relevant Environment and Object Class. Once chosen, activate Smart Recognition and click on “Configure”.
Click either Add or Remove.
Select the necessary properties:
Conclude your selection and click OK when you’re done.
The aforementioned procedure makes sure that the next time QTP struggles to identify an object of this class, it will employ smart recognition to do so.
For most objects, “Smart recognition” is activated by default. You can verify if this is the case for a specific object by accessing it in the OR within the “Additional details” section of the object’s properties. It will be marked as “True” if activated and “False” if deactivated.
You can also opt to globally enable or disable Smart detection for a test run. Select the “File -> Settings -> Run -> Deactivate Smart Detection during the run session” option.
Synchronization Point
Think about this program,
SystemUtil.Run "iexplore.exe", "http://www.gmail.com" Browser("Gmail: Email from Google").page("Gmail: Email from Google").Sync Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set "swatiseela" Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Passwd").SetSecure "sfgs686898" Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebButton("Sign in").Click Browser("Gmail: Email from Google").Page("Gmail - Inbox").Link("Sign out").Click
In an ideal scenario, the moment you click on the “Sign in” button on the Gmail sign-in page, the “Inbox” should promptly appear without any delay. This indicates that the application is ready for the final statement in our example to be executed immediately following the execution of the penultimate statement.
However, in reality, applications don’t always load at the same speed. If we don’t instruct QTP to pause for a certain period before proceeding further, particularly until an object reaches a specific state, the execution might lead to errors.
A synchronization point is employed to instruct QTP to wait until a certain object attribute attains the indicated value.
When a sync point is inserted, a “Wait Property” statement is added to the test.
Browser("Gmail: Email from Google").Page("Gmail - Inbox").Link("Sign out").WaitProperty "Visible", True, 20
So your updated program will appear as follows: (line #6 beneath)
<
pre class=”brush: vb; title: ; notranslate” title=””>
SystemUtil.Run “iexplore.exe”, “http://www.gmail.com”
Browser(“Gmail: Email from Google”).page(“Gmail: Email from Google”).Sync
Browser(“Gmail: Email from Google”).Page(“Gmail: Email from Google”).WebEdit(“Email”).Set “swatiseela”
Browser(“Gmail: Email from Google”).Page(“Gmail: Email from Google”).WebEdit(“Passwd”).SetSecure “sfgs686898”
Browser(“Gmail: Email from Google”).Page(“Gmail: Email from Google”).WebButton(“Sign in”).Click
Browser(“Gmail: Email from Google”).Page(“Gmail