1. We are not accepting any new account registrations at this time.

How to the test user interface of a VCL application?

Discussion in 'HelpDesk' started by Viertausend, Apr 5, 2018.

  1. Vi

    Viertausend Registered User

    Joined:
    Jul 8, 2009
    Messages:
    12
    Likes Received:
    22
    Hi guys,

    how do you handling the test of the user interface? I want to emulating sequences of clicks etc.

    There is software like TestComplete but is it really necessary to use an tool like this? The WPF folks has some ways to do it via code or CodedUI tests. Delphi does not have build-in tools like CodedUI or am I missing something?

    How are you handling automatic testing of the ui?

    Best wishes
     
    1 person likes this.
  2. yogiyang

    yogiyang Registered User

    Joined:
    Dec 16, 2009
    Messages:
    442
    Likes Received:
    2,025
    Hello,

    I would suggest you to check out AutoIT. You can easily program in AutoIT to generate clicks, mouse moves, etc.

    You can also record you actions in AutoIT.

    HTH
     
    2 people like this.
  3. Vi

    Viertausend Registered User

    Joined:
    Jul 8, 2009
    Messages:
    12
    Likes Received:
    22
    That's some interesting thing. The recorder seems to be a thing I should check out!

    Thank you.
     
    1 person likes this.
  4. Yr

    Yri147 Registered User

    Joined:
    Sep 19, 2017
    Messages:
    21
    Likes Received:
    31
    Selenium
    AutoIT
    AutoHotKey
     
  5. Wonderman

    Wonderman is a Trusted Warez PosterWonderman DEV Guild Member DEV Guild

    Joined:
    Mar 16, 2011
    Messages:
    2,628
    Likes Received:
    18,235
    Winautomation, Ranorex, and others are available on this forum you can use for codedui testing.
     
  6. Mavrick

    Mavrick is a Trusted Warez PosterMavrick Green and still mean :) Staff Member Super Moderator DEV Guild Reverser

    Joined:
    Feb 21, 2009
    Messages:
    742
    Likes Received:
    3,838
    Am I missing something! Why don't you do it in code?
    object Form1: TForm1
    Left = 0
    Top = 0
    Caption = 'Form1'
    ClientHeight = 197
    ClientWidth = 206
    Color = clBtnFace
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = []
    OldCreateOrder = False
    PixelsPerInch = 96
    TextHeight = 13
    object btn1: TButton
    Left = 8
    Top = 8
    Width = 75
    Height = 25
    Caption = 'One'
    TabOrder = 0
    OnClick = btn1Click
    end
    object btn2: TButton
    Left = 112
    Top = 8
    Width = 75
    Height = 25
    Caption = 'Two'
    TabOrder = 1
    OnClick = btn1Click
    end
    object btn3: TButton
    Left = 8
    Top = 80
    Width = 75
    Height = 25
    Caption = 'Three'
    TabOrder = 2
    OnClick = btn1Click
    end
    object btn4: TButton
    Left = 112
    Top = 80
    Width = 75
    Height = 25
    Caption = 'Four'
    TabOrder = 3
    OnClick = btn1Click
    end
    object btnStart: TButton
    Left = 64
    Top = 144
    Width = 75
    Height = 25
    Caption = 'START'
    TabOrder = 4
    OnClick = btnStartClick
    end
    end
    Code:
    unit Unit1;
    
    interface
    
    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
    
    type
      TForm1 = class(TForm)
        btn1: TButton;
        btn2: TButton;
        btn3: TButton;
        btn4: TButton;
        btnStart: TButton;
        procedure btn1Click(Sender: TObject);
        procedure btnStartClick(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    procedure TForm1.btn1Click(Sender: TObject);
    var
      buCaption: string;  // temp holder of the button caption
    begin
      if Sender is TButton then
      with Sender as TButton do
        begin
          buCaption := Caption;
          Caption := 'Pressed';
          Sleep(1000);
          Caption := buCaption;
        end; {end with}
    end;
    
    procedure TForm1.btnStartClick(Sender: TObject);
    begin
      btnStart.Enabled := False;  // so it's not triggered while already running
    
      btn1.Click;   // these run the same event for this example.
      btn2.Click;
      btn3.Click;
      btn4.Click;
    
      btnStart.Enabled := True;
    end;
    
    end.
     
  7. rn

    rnrstar Registered User

    Joined:
    Apr 16, 2010
    Messages:
    51
    Likes Received:
    189
  8. Wonderman

    Wonderman is a Trusted Warez PosterWonderman DEV Guild Member DEV Guild

    Joined:
    Mar 16, 2011
    Messages:
    2,628
    Likes Received:
    18,235
    I assume he is talking about GUI testing.
     
  9. MyRealName

    MyRealName Registered User

    Joined:
    Nov 6, 2008
    Messages:
    312
    Likes Received:
    1,815
    Ranorex is a test suite, that works with programs and websites. It records what the user does and can supposedly redo it in autmated tests later on. There was a version here at b4a some time ago, if I remember right
     
  10. MyRealName

    MyRealName Registered User

    Joined:
    Nov 6, 2008
    Messages:
    312
    Likes Received:
    1,815