Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

tzengshinfu/TestHelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 

Repository files navigation

必要元件:
1.Delphi 6以上

功能:
1.使用DUnit在進行GUI測試時, 截取MessageBox的文字內容。 使用方法如下:

type
  TTestHelper1 = class(TTestHelper);

var
  TestHelper1: TTestHelper1;

implementation

procedure TTestcase1.SetUp;
begin
  TestHelper1 := TTestHelper1.Create();
end;

procedure TTestcase1.Test_Add;
var
  messageBoxContent: string;
  result: string;
begin
  Application.Initialize();
  Application.CreateForm(TForm1, Form1);
  Form_Calculater.Show();

  Form_Calculater.Summand.Text := '1';
  Form_Calculater.Addend.Text := '2';
  result := '3';

  TestHelper1.WaitForMessageBox('Calculater');
  Form1.Button1.Click;
  messageBoxContent := TestHelper1.GetMessageBoxContent();
  Check(messageBoxContent = result, '相加功能異常!!');
end;

Releases

No releases published

Packages

No packages published

Languages