Smart Identification - Use-case scenario
Relevant for: GUI tests and components
The following example walks you through the object identification process for an object:
Suppose you want to view the two products you added to the shopping cart, you have the following statement in your test:
Browser("Advantage Shopping").Page("Advantage Shopping").Link("ShoppingCart").Click
When you created your test, OpenText Functional Testing learned the following object description for the shopping cart:
Later, you may add another product to the shopping cart and want to display the total products in the cart again.
The default description for link objects (text, role, html tag, and acc_name) works for most links in the demo site, but it no longer works for the shopping cart now as you added another product and the shopping cart's text property no longer matches the description learned previously. Therefore, when you run your test, OpenText Functional Testing is unable to identify the link based on the learned description. However, using the Smart Identification mechanism, OpenText Functional Testing succeeds in identifying that link.
The following explanation describes the process that OpenText Functional Testing uses to find the shopping cart object using Smart Identification:
-
According to the Smart Identification definition you have for Web link objects, OpenText Functional Testing learned the values of the following properties when it learned the shopping cart link:
-
The Smart Identification process starts by identifying several link objects that match the base filter properties definition (html tag = A). These are considered to be the object candidates, which are then checked against the Optional Filter Properties list.
-
The text property of each of the object candidates is checked, but none have the text value: 2, so this property is ignored.
- The html id property of each of the object candidates is checked, and the other objects are filtered out. Because the site only has one link object that matches the html id property, Smart Identification correctly concludes that it has found the shopping cart link and the link is clicked.
The learned values are as follows:
Base Filter Properties:
Property |
Value |
---|---|
html tag |
A |
Optional Filter Properties:
Property |
Value |
---|---|
text |
2 |
html id |
shoppingCartLink |
class |
img |
name |
2 |
href |
http://www.advantageonlineshopping.com/#/shoppingCart |
visible | True |
acc_name | ShoppingCart |