title: Delphi GUI Testing and Modal Forms
body: <p>In this interesting blog post on <a href="http://delphixtreme.com/wordpress/?page_id=2">delphiXtreme</a> I read about DUnit's built-in GUI testing capabilities (basically an alternative test case class <code>TGUITestCase</code> defined in unit <code>GUITesting</code> that has several utility functions for invoking actions in the GUI). I was quite happy with it until I noticed that it didn't work with modal forms. For example the following sequence won't work if the first button shows a modal configuration form:</p>
  
  <pre><code>Click ('OpenConfigButton');
  Click ('OkButton');
  </code></pre>
  
  <p>The second <code>Click</code> is only executed when the modal form is closed, which I have to do manually. </p>
  
  <p>I don't know much about how modal forms work in  the background but there must be some way to circumvent this behaviour. Naively, I want to somehow execute the <code>ShowModal</code> "in a thread" so that the "main thread" stay responsive. Now I know that running <code>ShowModal</code> in a thread will probably mess up everything. Are there any alternatives? any way to circumvent the blocking nature of a  <code>ShowModal</code>? Has anybody some experiences with GUI testing in Delphi?</p>
  
  <p>I know about external tools (from QA or others) and we use those tools, but this question is about GUI testing within the IDE.</p>
  
  <p>Thanks!</p>