...
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 accordingly they are is classified in different categories based on this. Following The following are the commonly used objects:
...
In general, an attribute is a property or characteristic. Color, for example, is an attribute of your hair. In your 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 (hpHP).
Similarly, objects in software applications also have attributes. It is important to know the attributes of an object and its role in test automation.
Following The following are a few of the commonly referred attributes in functional test automation.
...
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:
...
Object may have multiple attributes and identifying a unique set of attributes and its associated value is most 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 HTML page.
The above page has two identical text boxes. If you need to use only the first text box in our 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.
...
Anchor | ||||
---|---|---|---|---|
|
Static object is the 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 id's 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.
Anchor | ||||
---|---|---|---|---|
|
Dynamic object is the 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 a complete control of predictable dynamism.
There are cases where dynamisms dynamism of attribute values are value is not predictable. Do not use such attributes.