Document toolboxDocument toolbox

A new version of Qualitia Automation Studio for Web and Mobile 7.2.x is now available. We highly recommend you upgrade. Find more details here.

Object and their Attributes

Objects

Objects are keys for understanding Test Automation. Objects are nothing but the controls used in the application.
In the figure shown below, you can see 'Username'. It is an object called 'Label'. Text box below 'Username' is another object called as 'TextBox' or 'WebEdit'. Similarly you can also see other objects like 'check box' as well as 'button' (Sign in).

Every object type has a unique functionality and is classified in different categories based on this. The following are the commonly used objects:

Object Attributes

In general, an attribute is a property or characteristic. Color, for example, is an attribute of your hair. In the application under test, an attribute is a changeable property or characteristic of the control, which can be set to different values.
In the real world, you will find many examples of objects: Car, computer, mobile phone, or bicycle. Real-world objects also share characteristics. Car has color, model, company name, horsepower (HP).
Similarly, objects in software applications also have attributes. It is important to know the attributes of an object and its role in test automation.
The following are a few of the commonly referred attributes in functional test automation.

  • Name
  • ID
  • Class

Let us take an example:

Here 'Sign in' is an object of type button and it has the following attributes with associated values of the attributes:

  • Name: Sign in
  • Color: Blue

Selection of Attributes

Object may have multiple attributes and identifying a unique set of attributes and its associated value is the fundamental success criteria for your test automation tool to identify a particular object uniquely every time during test automation.
For example, consider the following HTML page.

The above page has two identical text boxes. If you need to use only the first text box in your test automation, you should use a particular attribute such that its value is unique and your automation tool is able to point to this particular object.
In this example, the first text box has value attribute = val1. You may make use of value attribute in this case. However, it may not be as simple as it appears above if the value attributes changes for some reason during the next iteration of testing.

Static and Dynamic Objects

Static Objects

Static object is one for which the value of attribute does not change. For example, value of colors property of Indian National Flag will never change.
Best practices in identifying Static Object:
Out of all the attributes, the most static attribute known is the 'name' attribute. Next is the 'id' attribute as IDs can change, since there are few development frameworks that dynamically generate values for id attribute. For all such applications, 'id' attribute becomes the most dynamic.

Dynamic Objects

Dynamic object is one for which the value of attribute is prone to change. For example, value of size property of Indian National Flag can change.
Best practices in identifying Dynamic Object:
To identify an object, never select an attribute that has a dynamic value. Look for any other attribute(s), which are expected to remain static and points to the desired object uniquely. If there are no such attributes, try to use 'regular expression' to avoid dynamism. This is possible if the attribute value has some static and some dynamic portion. You can even parameterize the value to take complete control of predictable dynamism.
There are cases where dynamism of attribute value is not predictable. Do not use such attributes.

Not finding what you need?