понедельник, 16 марта 2015 г.

GUI-testing 12. GUI-testing "in the spoken style". Back to the basics

Original in Russian: http://18delphi.blogspot.ru/2013/11/gui-back-to-basics.html

GUI-testing. Table of contents

They wrote to me that I “write in lecture and it would be better in seminar”..

I’ll try the seminar. (Not finished)


So.

The main points:

1. Test has to be benchmark, anchor test
2. looking like test-case
3. readable for a human being
4. Making use of terms of application environment
(we’ll get back to these points again)


I’ll try to make a finished example in “classic RAD-style”.

And in some way “in XP style” - http://18delphi.blogspot.com/2015/02/about-rs-time-pressure-and-forgetting.html.

If it is not clear what to do I will write Asserts.

The example is available here - https://sourceforge.net/p/rumtmarc/code-0/HEAD/tree/trunk/Blogger/GUITests/Chapter0/

Let’s create a form TForm1 with buttons Button1, Button2, Button3 and an input stream Edit1.

Thus, we add  “publicity” and “novelty of the approach” on FM.

So, our form:

unit Unit1;
 
interface
 
uses
  System.SysUtils, System.Types, System.UITypes, System.Rtti, System.Classes,
  System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs,
  FMX.StdCtrls, FMX.Edit;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Edit1: TEdit;
    Run: TButton;
    procedure Button1Click(Sender: TObject);
    procedure RunClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
 
implementation
 
uses
 Script.Engine
 ;
 
{$R *.fmx}
 
procedure TForm1.Button1Click(Sender: TObject);
begin
 Edit1.Text := (Sender As TButton).Text;
end;
 
procedure TForm1.RunClick(Sender: TObject);
begin
 TScriptEngine.RunScript('FirstScript.script');
end;
 
end.

And its fmx:

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 480
  ClientWidth = 640
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [dkDesktop, dkiPhone, dkiPad]
  DesignerMobile = False
  DesignerWidth = 0
  DesignerHeight = 0
  DesignerDeviceName = ''
  DesignerOrientation = 0
  object Button1: TButton
    Height = 22.000000000000000000
    Position.X = 24.000000000000000000
    Position.Y = 24.000000000000000000
    TabOrder = 0
    Text = 'Button1'
    Width = 80.000000000000000000
    OnClick = Button1Click
  end
  object Button2: TButton
    Height = 22.000000000000000000
    Position.X = 24.000000000000000000
    Position.Y = 64.000000000000000000
    TabOrder = 1
    Text = 'Button2'
    Width = 80.000000000000000000
    OnClick = Button1Click
  end
  object Button3: TButton
    Height = 22.000000000000000000
    Position.X = 24.000000000000000000
    Position.Y = 104.000000000000000000
    TabOrder = 2
    Text = 'Button3'
    Width = 80.000000000000000000
    OnClick = Button1Click
  end
  object Edit1: TEdit
    TabOrder = 3
    Position.X = 136.000000000000000000
    Position.Y = 24.000000000000000000
    Width = 100.000000000000000000
    Height = 22.000000000000000000
    KillFocusByReturn = False
  end
  object Run: TButton
    Height = 22.000000000000000000
    Position.X = 24.000000000000000000
    Position.Y = 144.000000000000000000
    TabOrder = 4
    Text = 'Run'
    Width = 80.000000000000000000
    OnClick = RunClick
  end
end

Meanwhile, the readers can look at code sketch. And the commentaries to commits.

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

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