Coded UITest Builder (launched from Visual Studio) can be used to record set of user actions and it can be converted into a Coded UITest (with the actions converted to code) and the actions can be played back when the test is run. When the recording is done on web applications the recording engine in the Coded UITest Builder records hovers when user moves the mouse over a menu implementation. Internally HTML doesn’t support a menu control like Winforms or WPF. The recording engine looks for property changes during mouse moves to figure out if there’s a need to record hover. Since the engine is tweaked to perform on different websites, sometime the default setting used results in lots of extra hovers being recorded,
However there is a config that can be tweaked to reduce the hovers as per the need of individual web apps. The general logic followed to record hover is to look for css property changes that can cause a display change (style.display changing from “none” to a valid value indicates that a control has become visible). When such a property change occurs, a mouse hover is recorded over the control over which the mouse is present at that instant. Now the window during which we look for such property changes should ideally be between when the mouseover event (the user moves into a control, say a menu item) and the next mouse move event. But different implementations of menus exist, example one which creates a timer based execution tin the onmousehover eventhandler to show a submenu in a delayed manner. There are other cases where onmousemove handlers have been used to show submenus). As a result there’s no restriction on the window during which we look for these display property changes in the engine implementation. However you can tweak it using the a OR’ed value of the below values as per the need of the individual apps to reduce hovers.
<add key=”ImplicitHoverLevel” value=”1”> No hovers will be recorded.
<add key=”ImplicitHoverLevel” value=”14”> (OR’ed 2,4,8 will not consider css classname change for recording hover, plus will look for hover changes within a restricted window of mousehover event and mouse move event)
The above key needs to be set in the CodedUITestBuilder.exe.config or mtm.exe.config (depends on the client that’s being used for recording).
Default = 0,
/// Hover script won;t be added
DoNotRecordImplicitHover = 1,
/// CSS Classname changes will be ignored
IgnoreClassNameChanges = 2,
/// Property changes in Mouse move will be ignored
IgnoreMouseMoveChanges = 4,
/// Property changes post mouse hover (like using timer to change the property)
/// will be ignored
IgnorePostHoverChanges = 8,