Have you ever tried to record a business process only to have the objects not recognized by TruClient?
While you are thinking about it, when was the last time you’ve tried to identify an application object and failed?
In TruClient we introduced a new feature (available from version 12.02) that might solve these types of challenges immediately.
TruClient is an innovative browser-based testing technology for performance, load and automation.
It utilizes a unique, patented approach to object recognition, which makes it an extremely flexible and extensible solution for testing Web2.0 applications.
TruClient was introduced to the world few years ago as a novel and groundbreaking solution for load testing Web2.0 Rich Internet Applications (RIA). TruClient technology was first implemented as a browser extension integrated with the Firefox browser in LoadRunner 11.00. In LoadRunner 11.50, the TruClient for Microsoft Internet Explorer (IE) protocol added the same functionality integrated into the IE browser.
Introducing TruClient Descriptors
In the cases where the automatic object identification method is insufficient for your use case or the improved object identification does not help, you can now use a new object identification method that will enable you to define and pinpoint the required object.
What are Descriptors?
The nametag “Descriptors” comes from the fact that they describe the object in a more intuitive and visual way.
With the new Descriptors method, you can watch, select and adjust the properties of the object that TruClient should look out for.
Properties can also be deleted or added, parameterized and programmed.
To show an example of the use of TruClient Descriptors:-
- Let’s say you start recording and then realize that TruClient misses an object ...
- Open the Step Object section in TruClient
- In the ID Method line select Descriptors
- Choose the ‘Click Here to Edit’ button.
- The Descriptors Editor dialog box opens up and you can edit the descriptors here.
- After you are done, press the OK button and the script will now identify the object with Descriptors.
What actually happens during the Recording phase?
During the recording process, TruClient gathers information from the object and creates the Descriptors data set.
In that data set there are three main entities – Property, Operator and Value.
For example, TruClient always identifies tagName as a first mandatory property with operator ‘equals to’ (case ignored), the value changes based on the identified element.
In the above snapshot it is ‘A’ since TruClient identified a link.
In the example above there is additional property, “text”, with “LEARN HTML” as its’ value.
In many cases the automatically generated properties are sufficient for identifying the object.
But if not, feel free to add additional properties manually.
Enhancing the Description
In some cases, the recorded description has to be modified for various reasons.
For example, to create a more accurate identification, to parameterize a value of one of the properties or to find one of the occurrences of an object that appears several times on the same page.
To support that, TruClient Descriptors provides several options.
The following examples illustrates possible use cases and their solution.
- Parameterize a value
In some business processes you are required to click a different menu item for each iteration, as shown here:
Recording the click on the first link will result in the following description:
The value of the text is now interpreted to a constant value “CSS HOME”.
In our complex scenario, we want to enhance it a little so each time TruClient runs, it will choose a different link from the list of parameters.
- Now change the value of the text to be taken from a parameter: TC.getParam("LinkText")
- Lastly, define the “LinkText`” in VuGens Parameter List:
- Finally, run the script.
Now, for each iteration the next link will be activated.
Note, in VuGen you can make the ‘Select Next Line’ either Random or Sequential etc. to comply with your business requirements.
- Object ordinal
When there are multiple objects with similar characteristics on the same page and you need to use one of them, there is a need to somehow identify it uniquely.
If there is a different constant property that is unique to the searched object, it can be added using the “New Condition” button.
If no such distinctive property exists, use the “Object Ordinal” definition to specify which occurrence to choose.
(The default ordinal number is 1, in the snapshot below it was changed to 2).
If you aren’t sure which object should be selected, use the “Highlight” button when the application is open on the relevant page.
Note that you can also parameterize the Ordinal value as shown below.
This could be used when your application has multiple objects with the same characters and you wish to click on a different object for each iteration.
The parameter will have the sequential values 1-n and each iteration TruClient will find one of the similar objects.
Advanced TruClient Descriptors settings
- Add a Descriptor Property
You can add a new property to the descriptors.
It can be a TruClient pre-defined property from the list of properties (e.g. id, name, class, label and more) or it can be a custom property or attribute.
The function interacts with the application DOM to get the attribute value.
- Deleting a Descriptor property
It is also possible to delete a property in cases where it does not contribute to the object description. When the property value is dynamic you should consider deleting the property and use something else that uniquely identifies the object (e.g. ordinal).You can also use it with a different operator or write a function that will return the value using the same logic the application under test (AUT) uses.
There are several operators you can use to test the property value.
Apart from the simple operators like ‘equals’, ‘equalsIgnoreCase’, ‘equalsIgnoreDigits’ etc. there are advanced operators:
Compares the object property to the value specified in the descriptor editor ignoring any characters specified in the Arguments section.
For example, a descriptor with:
“Text” as Property
'equalsIgnoreChars’ as Operator
“X” as Value and “Y and Z” as arguments
will return True for an Object with ‘XYZ’ text.
Checks if the object property matches a regular expression specified in the value.
As explained in this post, TruClient Descriptors offer a non-technical approach for identifying Objects in the application. The Descriptors can be customized to handle dynamic application data, using a wide range of capabilities for both the novice and expert users.
Thanks to Michal Barak for providing this informative post.
Feel free to leave a comment in the box below.