That threading issue seen at DDD3 in the session demo

At DDD3 when I was demo'ing GUITester I said there was a problem with the tests that used multi-threading were failing. This used to work with .Net 1.1 but not with 2.0.

Due to the short notice of doing the session I did not have time to find the answer before the talk. However I have found it now. As I had guessed the issue was the increased security in .Net 2.0. I have done a quick dirty fix and this was to add the CheckForIllegalCrossThreadCalls line, as shown below

if (_useThreading==true)
{
   _obj =obj;
   _mInfo = mInfo;
   //when GUITester was updated from VS.Net 1.1 to 2.0 the following
   //line had to be added as 2.0 stops CrossThreadCalls security checks
   // this is not the best solution,
   System.Windows.Forms.Form.CheckForIllegalCrossThreadCalls = false; Thread worker = new Thread(new ThreadStart(ClickIt));
   worker.Start();
   Application.DoEvents();
} ......

to the DoTest() method in ClickOpenFormTestBaseAttribute.cs.

This a dirty fix, I should really migrate to the new Backgroundworker class model

I have rebuilt the distribution file with this fix in it which can be found at http://www.blackmarble.co.uk/guitester/GUITesterSourceV2.1.zip

So I think the major gottas in this release are:

  • the app.config file for an application under test is not read, there is a workround but this does involved a hard coded path in the sample application
  • the integration with Visual Studio Team Developer edition runs all the GUITester tests in one VS Test. It stops at the first failing test