Tuesday, 11 November 2014

Possible Exceptions and their cause in Coded UI


Here are some of the guidelines to troubleshoot the failure during recording/playback.

 

Recording Time Failures


Possible ExceptionCauseComment
TechnologyNotSupportedExceptionRecoding on a unsupported technology AppAs mentioned above Winforms/WPF/Web are three different kind of technologies supported by UITest so if user tries to record on some other technology we fail with the following exception.
ApplicationFromNetworkShareExceptionRecording on a Network share applicationThis occurs when the recording is being done on a network share App.


Playback time failures

Playback does two major things in order to perform action on the control search and action on the control. Following are the possible reasons and their exceptions.

Search Failure


Following are some of the suggested tips to debug the search failure during playback.

Possible ExceptionCauseComment
UITestControlNotFoundExceptionThe control does not exist or search properties are not enough to find the controlUser can use AccExplorer and see whether the search properties and the hierarchy are correct
UITestControlNotAvailableExceptionThe control does not exist in the app now.If the control has been invalidated or deleted during the playback, the window handle and other properties related to it would be invalid then.

Action Failure


Sometime though the search passes but the playback may not be able to do the action on the control. Following may be the possible reason/tips to debug the issue

Possible ExceptionCauseComment/Possible workarounds
ActionNotSupportedOnDisabled
ControlException
Playback is trying to perform action on a disabled controlThis is thrown when the playback try to do some action on the disabled control/read only controls. Following are some of the cases:
· SetValue on a read only combobox/text box
· Click/SetState on buttons/checkboxes
FailedToLaunchApplicationExceptionWhen the playback fails to launch the AuTVerify whether the LaunchApp was recorded on the original exes or on some other file e.g., sometime if a App launches SPLASH screen before the original AuT LaunchApp is recorded on splash screen, user can work around this in API playback by changing the path
FailedToPerformActionOnBlocked
ControlException
The control exists but not actionableThrown when a control is blocked in this case though the search passes but the required action will not be played back. Following might be some of the causes for this exception
· The control is not visible in the view port and not scrollable even
· Control is blocked due to some modal dialog on top of it
DecodingFailedExceptionMay come in password text boxWhen the decoding fails due to incorrect key value in password encryption.
PlaybackFailureExceptionDefault fall back exception for uncategorized issuesFor any other failure the playback engine would throw PlaybackFailureException. For example if Get/Set of some property fails for a control playback engine would throw PlaybackFailureException.