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

This assumes you have already installed the DUnitX Wizard.

Creating your first test

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

unit Unit1;

interface
uses
  DUnitX.TestFramework;

type

  [TestFixture]
  TMyTestObject = class(TObject)
  public
    [Setup]
    procedure Setup;
    [TearDown]
    procedure TearDown;
    // Sample Methods
    // Simple single Test
    [Test]
    procedure Test1;
    // Test with TestCase Atribute to supply parameters.
    [Test]
    [TestCase('TestA','1,2')]
    [TestCase('TestB','3,4')]
    procedure Test2(const AValue1 : Integer;const AValue2 : Integer);
  end;

implementation
Clone this wiki locally