Recording Hover’s in CodedUITest
Mouse Hover is an important part of a Application WorkFlow. Hovering on a control brings about changes in the application which leads to Controls appearing/disappearing , Properties of the controls being changed ,new windows coming up etc. Needless to say it is pertinent that all the Hover Actions are identified correctly during recording to ensure a proper Playback.
For recordings on WEB Applications CodedUITest intelligently identifies that an Hover action has been performed on the application and records a Hover-Action on the control on which the Mouse was hovered . This type of auto-generated Hover-Action is referred to as IMPLICIT HOVER. The action such generated was not explicitly performed by the User (however not recording the action would most certainly lead to a faulty recording) and as such is tagged with the ContinueOnError flag. This indicates that even if the action is not played back the Test wont fail and execution will pass on to the next Step. The code generated for Implicit Hovers will look like
// Set flag to allow play back to continue if non-essential actions fail. (For example, if a mouse hover action fails.)
Playback.PlaybackSettings.ContinueOnError = true;
// Mouse hover 'My Bay' link at (56, 3)
Mouse.Hover(uIMyBayHyperlink, new Point(56, 3));
// Reset flag to ensure that play back stops if there is an error.
Playback.PlaybackSettings.ContinueOnError = false;
Implicit Hover is a very cool feature in CodedUITest and greatly improves User experience.
The Implicit Hovers can be turned off by modifying the CodedUITestBuilder.exe.config and changing the value of the RecordImplicitHover key. By Default it is turned ON.
<!--Use this to enable/disable recording of implicithovers.-->
<add key="RecordImplicitHover" value="true"/>
This can be similarly turned OFF in the Fast-Forward a Manual Test scenario by updating the mtlm.exe.config.
For Client Side Applications Hover-Actions are not recorded implicitly. User has to record the Action Explicitly by Hovering the Mouse on the desired location and pressing a combination of keys to record the Hover-Action. The default Key combination are CTRL + SHIFT + R. The default value can be changed by updating the config files as mentioned above. Explicit Hovers are actual User Actions and are not marked with ContinueOnError flag as a result.
<!-- HoverKey to use. -->
<add key="HoverKeyModifier" value="Control, Shift , Alt"/>
<add key="HoverKey" value="R"/>
Explicit Hover action can be generated for Web Applications as well..