Page 1 of 1

Automated GUI Tests or []DQ considered harmful

Posted: Wed Jul 27, 2011 5:58 pm
by paulmansour
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?

Re: Automated GUI Tests or []DQ considered harmful

Posted: Tue Sep 20, 2011 5:19 pm
by Tomas Gustafsson
5 cents: Have a common, smart "input entering" (sub)form TESTFORM with associated logic hanging around. Always when DQ'ing a form, first set TESTFORM as a child to your DQ'ed form, hopefully hereby keeping TESTFORM alive and running (running eg timers and executing their callbacks).

At least with WinAPI you can change the parent of a form, but i'm not sure how Dyalog follows that. But sure one could re-create TESTFORM at any time, as a child of the modal forms?

Generic TESTFORM logic could then analyze the parent form's elements, throw all kind of rubbish into each edit field, illogically make combo box selections, press wrong buttons, etc.

5 cents, as said.

Re: Automated GUI Tests or []DQ considered harmful

Posted: Mon Oct 03, 2011 1:49 am
by alexbalako
Paul,

On my recent project that lasted 3 years I found it very useful to write cover functions for system functions.
if you would replace []DQ with cover it would be easy to write your automated test or find other ways of running your code for example:
- batch run
- encapsulate your app into windows service
- write remote control of application
etc.