Automated GUI Tests or []DQ considered harmful

General APL language issues
Post Reply
paulmansour
Posts: 431
Joined: Fri Oct 03, 2008 4:14 pm

Automated GUI Tests or []DQ considered harmful

Post 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?
Tomas Gustafsson
Posts: 101
Joined: Mon Sep 19, 2011 6:43 pm

Re: Automated GUI Tests or []DQ considered harmful

Post 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.
alexbalako
Posts: 16
Joined: Mon Nov 30, 2009 8:58 pm

Re: Automated GUI Tests or []DQ considered harmful

Post 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.
Post Reply