From: Alexander H. <ha...@us...> - 2001-12-31 02:21:10
|
I am trying to use DUnit to test a simple GUI application (just a form with an editbox). I created a TGuiTestCase that should write the letter 'a' into the editbox using EnterKeyInto. I then check whether the editbox contains the 'a'. But the test always fails. Instead of 'a' the letters '11' appear in the editbox. If I try the same with 'b' the letters '22' will appear. I am new to DUnit, probably I have some fundamental problem in understanding it. I would appreciate any help. I am using Delphi 6 Enterprise and DUnit v.5.01 Thank you very much - Alexander Hars My test application consists of three units: Project1 (Test project) Unit1 (TForm with TEdit) Unit2 (Testcase) =========Project1.dpr========================== program Project1; uses Forms, TestFrameWork, GUITestRunner, Unit1 in 'Unit1.pas' {Form1}, Unit2 in 'Unit2.pas'; {$R *.res} begin Application.Initialize; GUITestRunner.RunRegisteredTests; end. =========Unit2.pas========================== unit Unit2; interface uses TestFramework, GUItesting, unit1, dialogs, forms; Type TTestCaseFirst = class(TGuiTestCase) published procedure TestFirst; end; implementation { TTestCaseFirst } procedure TTestCaseFirst.TestFirst; begin Application.CreateForm(Tform1,form1); Gui := form1; show(true); EnterKeyInto(form1.Edit1,'a',[]); check(form1.edit1.text = 'a','Key did not get through'); end; initialization TestFramework.RegisterTest(TTestCaseFirst.Suite); end. =========Unit1.pas========================== unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Edit1: TEdit; private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} end. |