Note that there are some explanatory texts on larger screens.

plurals
  1. PODUnit: How to run tests?
    primarykey
    data
    text
    <p>How do i run <strong>TestCase</strong>'s from the IDE?</p> <p>i created a new project, with a single, simple, form:</p> <pre><code>unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) private public end; var Form1: TForm1; implementation {$R *.DFM} end. </code></pre> <p>Now i'll add a test case to check that pushing <code>Button1</code> does what it should:</p> <pre><code>unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.DFM} uses TestFramework; type TForm1Tests = class(TTestCase) private f: TForm1; protected procedure SetUp; override; procedure TearDown; override; published procedure TestButton1Click; end; procedure TForm1.Button1Click(Sender: TObject); begin //todo end; { TForm1Tests } procedure TForm1Tests.SetUp; begin inherited; f := TForm1.Create(nil); end; procedure TForm1Tests.TearDown; begin f.Free; inherited; end; procedure TForm1Tests.TestButton1Click; begin f.Button1Click(nil); Self.CheckEqualsString('Hello, world!', f.Caption); end; end. </code></pre> <p>Given what i've done (test code in the GUI project), how do i now trigger a run of the tests? If i push <kbd>F9</kbd> then the form simply appears:</p> <p><a href="http://i39.tinypic.com/zsobhv.jpg">alt text http://i39.tinypic.com/zsobhv.jpg</a></p> <p>Ideally there would be a button, or menu option, in the IDE saying <strong>Run DUnit Tests</strong>:</p> <p><a href="http://i44.tinypic.com/24wvipw.jpg">alt text http://i44.tinypic.com/24wvipw.jpg</a></p> <p>Am i living in a dream-world? A fantasy land, living in a gumdrop house on lollipop lane?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload