Warning: fopen(/tmp/SghXTngBZPli-ICTWij.tmp): failed to open stream: Disk quota exceeded in /home/executea/public_html/blog/wp-admin/includes/class-wp-filesystem-ftpext.php on line 139
Warning: unlink(/tmp/SghXTngBZPli-ICTWij.tmp): No such file or directory in /home/executea/public_html/blog/wp-admin/includes/class-wp-filesystem-ftpext.php on line 142
In this post, we will start working with Error/Exception handing in Coded UI Testing. In the last post, we discussed about Assertions in coded UI testing. In Assertions we saw how coded UI testing stops its execution without moving forward to the next operation if the Assertion fails. Even though the behavior is expected, in some situation we would like our test to move forward if there happens any failure due to Validation
Thus in this topic, we will discuss how to handle Error/Exception in code, if there happens any failure only during Validation process but not during
Finding of Element
Performing operation in Element like enter text, click etc
Setting a property for the element
Note
Please don’t try to add exception handling which perform certain operations in the UI, since if that operation exception itself is handled, then that may result in unexpected behavior of test.
Error/Exception handling
We are going to handle Error/Exception in Coded UI testing using try .. catch block of C#.
Here is the complete video of the above explanation
Here is the code snippet of the same code which we discussed in previous post on Assertion in coded UI testing
Thanks for watching the video and reading the post !!!
Please leave your comments and let me know if there is anything need to be improved in this post.
Thanks,
Karthik KK
Post Author:
Karthik kk
4 Replies to “Exception handing in Coded UI Testing”
how to resolve the below error:
The web page could not be accessed ,if the page is refreshing ,please wait until the page refresh and perform action on it
I don’t think the exception handing on Assert is necessary. The assert throws an exception of its own when not true and thats what codedui uses to abort the test.
how to resolve the below error:
The web page could not be accessed ,if the page is refreshing ,please wait until the page refresh and perform action on it
You can write custom conditional Wait or WaitForProperty method.
Hi karthik,
I need to validate in a wintreeitem whether the rroot node is bold or unbold.
Is this possible in coded ui testing ?
I don’t think the exception handing on Assert is necessary. The assert throws an exception of its own when not true and thats what codedui uses to abort the test.