вторник, 17 марта 2015 г.

Testing of calculator №1. Configuring of infrastructure. Adding of DUnit

Original in Russian: http://programmingmindstream.blogspot.com/2014/02/1-dunit.html

Table of contents

The source code is available here.

Now let’s try to configure the infrastructure and integrate tests in the application.

First, we will add the lines in our project:

program DummyCalculator;
 
uses
  Vcl.Forms,
  MainForm in 'MainForm.pas' {fmMain}
  ,
  GUITestRunner // - we add the reference for testing framework
  ;
 
{$R *.res}
 
begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TfmMain, fmMain);
  GUITestRunner.RunRegisteredTestsModeless; // - we add the form with tests
  Application.Run;
end.

Now we add the FIRST TEST (yet empty):

unit FirstTest;
 
interface
 
uses
  TestFrameWork
  ;
 
type
  TFirstTest = class(TTestCase)
   published
    procedure DoIt;
  end;//TFirstTest
 
implementation
 
procedure TFirstTest.DoIt;
begin
 Check(true);
end;
 
initialization
 TestFramework.RegisterTest(TFirstTest.Suite);
 
end.

We get this:


I believe that’s enough for the beginning.

In the next chapter, I’ll tell about testing of application using the available GUI-controls.

Комментариев нет:

Отправить комментарий