Getting Started

Lars Fosdal edited this page Mar 25, 2014 · 10 revisions

This assumes you have already installed the DUnitX Wizard from the DUnitX source code.

Creating your first test

You need a test project, and one or more test units.

Creating a test project

From File|New|Other, select Delphi Projects and DUnitX Project

Adding a test unit

From File|New|Other, select Delphi Projects|Delphi Files and DUnitX Unit

Understanding the test unit

DUnitX uses Attributes and RTTI to identify and instrument a test. A TestFixture identifies your test object. Each test object needs Setup and Teardown methods, as well as Test methods with TestCase specifications. It can also have SetupFixture and TeardownFixture methods, which (Needs editing)

unit Unit1;



  TMyTestObject = class(TObject)
    procedure Setup;
    procedure TearDown;
    // Sample Methods
    // Simple single Test
    procedure Test1;
    // Test with TestCase Atribute to supply parameters.
    procedure Test2(const AValue1 : Integer;const AValue2 : Integer);


Each test fixture should be registered in the init section of the unit.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.