This blog
tells about How Object Identification Mechanism work for Coded UI.In
Coded Ui each object has some properties associated with it, basically it has
two types of properties associated, Search
Properties and Filter Properties. If the object’s Technology is Web then it
also has both Search and Filter properties associated with it.
Coded UI uses these properties to identify the
objects at runtime:
·
Search
Properties and Filter Properties of Coded UI
Object’s Properties in CodedUI Test Editor
When some object is added using the Coded UI Test
Builder and then generating the code using Generate Code button[right most in
the below screenshot], Coded UI adds these objects in a file called
UIMap(UIMap.uitest), Coded UI adds the exposed properties of the object as Search and Filter properties.
·
Coded UI Test Builder
· UI Map
·
Select the ‘Properties’ from context menu and
you will see ‘Search Properties’ and ‘Filter Properties’ of the selected object
in the Property Editor.
·
Search Properties:
·
Filter Properties:
·
You can edit the object’s properties based on
your requirements. E.g. if you know that object can be uniquely identified by
its ‘Id’, you can remove all other Search and Filter properties. This will
improve the performance of the CodedUI.
Search
Properties:
·
In case of Filter
properties, the properties get checked one by one in the sequential order.
·
If object cannot be identified based on one
filter property, then that property is ignored and Coded UI starts identifying
the object based on the next filter property.
Object
Identification Mechanism
During the Playback, Coded UI first searches for
the object having all the specified Search
Properties using ‘AND’ and then
one by one it searches with Filter Properties using ‘OR’ and returns the resultant UI Object.
Search, then the first object satisfying the
search would be returned.
· Unique property can be made as the ‘Search
property’ of the object, and other Search and Filter properties can be removed.
· If there are some properties in ‘Filter
Property’ which can help in identifying the object uniquely, make that property
as a ‘Search Property’.
· Coded UI uses Search and Filter properties of an
object for identifying it during the Playback.
· Coded UI performance can be improved by the use
of these properties and it makes the test automation stable for future.
· Exceptions
when property is not found.
In case of, Search Property not found:
For Web
Technology:
‘UITestControlNotFoundException’ will be thrown
For MSAA/UIA Technology:
‘System.ArgumentException’ will be thrown
In case of, Filter property not
found, it is just ignored.
looking great UI Online course Bangalore
ReplyDeleteThanks
ReplyDeleteHi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Online Training from India. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.
ReplyDeleteJavaScript Online Training from India
Thanks
Delete