Automated GUI Tests or []DQ considered harmful
Posted: Wed Jul 27, 2011 5:58 pm
A while back I determined that the use of []DQ on a form (a modal dialog box) in the middle of a function and waiting on the result (of []DQ) to determine what the user did (like hit the ok or cancel button) was fundamentally incompatible with automated tests. A typcial example might be a modal dialog box to get a string for some purpose. The problem is that I could find no way to write tests that would fire events or drive the dialog box - the []DQ kept getting in the way.
My solution was to use explicit callbacks (on the OK button for example) intead of exiting []DQ, and only execute the []DQ if not in testing mode. In other words the only use of DQ is to restrict the user from accessing other forms; it is NOT used to wait for a response and continue processing. The result is that []DQ is only ever used on the last line of a function. This is all good, and in fact has other benefits as well.
One drawback however is that it makes writing a little utility to get a string becomes a bit more complicated as the callbacks are now arguments to the utitliy function....
Anyway, my question is: did I miss some technique for writing automated tests on a typical use of []DQ embedded in the middle of a utility function? Or is it in fact impossible as I came to the conclusion earlier?
My solution was to use explicit callbacks (on the OK button for example) intead of exiting []DQ, and only execute the []DQ if not in testing mode. In other words the only use of DQ is to restrict the user from accessing other forms; it is NOT used to wait for a response and continue processing. The result is that []DQ is only ever used on the last line of a function. This is all good, and in fact has other benefits as well.
One drawback however is that it makes writing a little utility to get a string becomes a bit more complicated as the callbacks are now arguments to the utitliy function....
Anyway, my question is: did I miss some technique for writing automated tests on a typical use of []DQ embedded in the middle of a utility function? Or is it in fact impossible as I came to the conclusion earlier?