The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

    • G+ These are the command-line parameters I assembled to get close to “Ultra” compression from the 7-zip... 1 hour ago
    • Getting close to 7zip GUI “Ultra” compression from a batch file… 1 hour ago
    • RT @Nick_Craver: Nothing of what I planned to do today got done. Nothing. Nothing at all. But we kept the error count under 2.5 million beh… 8 hours ago
    • RT @kellabyte: I really don’t get the harsh criticism around Intel 3D XPoint. Yes they didn’t deliver persisted RAM. They did deliver 8x… 8 hours ago
    • G+ “Some managers just don’t recognize how profound the differences between their people are; others don’t... 9 hours ago
  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,347 other followers

Some links to Delphi Unit Testing history

Posted by jpluimers on 2015/01/29

Unit testing has been here for a long time, and so has Unit Testing in Delphi. Below a summary of historic links together with some notes on how the state of affairs changed over the years.

Charlie Calvert

I’ll start with one of the first large Delphi Unit Testing articles was a paper by Charlie Calvert summarizing the state of the art on Delphi Unit Testing in 2004. It is present in the wayback machine as DUnit Talk and on his site.

Note that the site is sometimes slow or hard to reach. Since his evangelist days at Borland/CodeGear, Charlie has moved through a few evangelist jobs at Falafel and Microsoft and finally went back to his old profession: being a great teacher – this time at Bellevue Collegeoften using script based languages and cloud computing, with less focus on his web-presence.

Many of his IT books (during his writing period, he wrote both as Charles Calvert and Charlie Calvert) are still relevant though.

DUnit; Juanco Añez

Charlie’s paper describes both NUnit (the .NET unit testing framework) and DUnit (originally by Juanco Añez as a 1-on-1 port from JUnit in 1999, the Delphi 5 era, back when Charlie was evangelist at Borland) with some sample code at charlie’s sourceforge site.

Back then, both the paper and the sample code were very welcome, as there was virtually no DUnit documentation (apart from the README and Juanco’s InPublishing articles about Extreme Testing and Extreme Testing for Delphi programs) and people tended to stick to their development stack (so there was not much mixing of the Delphi, Java and .NET world, luckily times have changed).

Around 2006, DUnit maintenance started to slow down, and – though still part of Delphi – around 2008 it completely stalled on CVS and SVN. But a fork appeared: DUnit2.

Juanco also developed a Delphi friendly build tool called WANT (after Ant, and NAnt), which now is at, but development also came to a halt in 2008 and the forum in 2010.

Mocking in Pascal and Delphi

Unit testing often requires mocking to simulate real world objects. There are about a dozen mocking libraries available for NUnit.

For Delphi, Kylix and FreePascal, PascalMock used to be the mocking library, but it too halted, probably because back then RTTI was only available for published members and there was no way to automatically mock new classes and create instances of them on the fly .

Since Delphi 2009 however, RTTI has broadened a lot, and Delphi XE2 introduced TVirtualInterface in 2011 to implement SOAP consumer clients in Soap.RIO.pas. A great article about that is TVirtualInterface: Interfaces without an Implementing Class.

So I was glad that – after in 2011 a getting started guide and coverage by Nick Hodges in Delphi Mocks The Basics appeared, the DelphiMocks got officially announced in late 2012: VSoft Technologies Blogs | Introducing Delphi Mocks.

DSharp has some mocks too that bind with DUnit.

mORMot has their own mocking classes based on their own virtual class factory and a nice discussion with the DSharp author.

See also: unit testing – What is your favorite Delphi mocking library? – Stack Overflow.


But first about DUnitWizard, which still is part of Delphi too. And there is DUnitWizard documentation!

Basically it is a wizard that allows you to select the project and source file for which you want to generate a unit testing skeleton unit.


DUnit2 is an improvement over DUnit: it improves both speed and structure, for instance allowing for “Early Exit”. The original aim was to merge back into DUnit, but that didn’t happen because DUnit2 also stalled in 2008. It does however have a better GUIRunner, so that might be worthwhile for future frameworks.

DUnit and DUnit2 are both used to test the tiOPF framework. The tiOPF is a native Object Persistence Framework for Delphi and FreePascal.

DUnit2 is also used to integrate into OpenCTF. With OpenCTF, you can test components (including Forms, Frames and DataModules) as well as classes. It tests all kinds of “obvious” things when using Delphi in a RAD way.

Remote testing your GUI using DUnit and automation

With the added RTTI in Delphi 2010 and up, you can now even remote test your GUI: André’s Dev Blog: Remote Control: automated GUI test with Delphi and DUnit. The proof of concept code is at


DUnitX is a complete rewrite, but has a DUnit compatibility layer.

A few main aims of DUnitX are to have it attribute based (for easier configuration), allow – like NUnit – any class to be a test fixture (added benefit of being attribute based), support for new features (collections, inversion of control, attributes) allowed by recent language improvements (generics, anonymous methods, attributes).

Another aim is to support NUnit XML output to make it easier to integrate with Continuous Integration systems (like Continua). On my research list is to check if DUnitX can be ran through the NUnit GUI Runner.

VSoft is actively maintaining DUnitX, introducing it in VSoft Technologies Blogs | Introducing DUnitX – A Unit Test Framework for Delphi.

The open source Delphi Unit Test project uses DUnitX as a foundation of their test suites.

Note the “new” Delphi language features (introduced in Delphi 2009, more or less stable in Delphi 2010 and having become more stable with every new Delphi version) has brought a plethora of new possibilities. Back then, I was hoping for fresh new libraries to come out, and indeed some of them have, of which a very incomplete overview:

There also used to be DeHL by Alex Ciobanu, but that development stopped around mid 2010 (the WiKi got removed at the end of 2010, but version r528 still has the WiKi). The same holds for his project delphi-coll – Generic collections library for Delphi 2010 and XE which stopped

German DUnit walk through

If you can read German, or can use Google translate, there is a good German walk-through on how to use DUnit (old broken link). Recommended!


TSynTest is a very light weight framework not compatible with DUnit or DUnit2.

It is used to test the synopse mORMot, another OPC framework for Delphi.

Sidestep to FreePascal

On the FreePascal side, there is fpcUnit, which is used to test the FreePascal database components. fpcUnit is an independent port of JUnit to FreePascal, so it is like DUnit, but slightly different, as described in Introduction to unit testing with Lazarus | The Programming Works.

fpcUnit is very similar to DUnit, but a lot less similar than DUnitX. For now, DUnitX cannot be used in FreePascal.

For FreePascal, there is also FPTest, which is a port of DUnit2 to FreePascal and used to test the FreePascal port of tiOPF (both now maintained by Graeme).

Mocking and Stubs

These are much related to unit testing, and you should read Martin Fowler’s article Mocks Aren’t Stubs before getting started.

Some frameworks are mentioned in these SO questions; more on those in a later blog post:

The Delphi Mocks Open Source Project on Ohloh.

Stubs and Mocks for Delphi with mORMot – Synopse.

Delphi Mocks: The Basics.


3 Responses to “Some links to Delphi Unit Testing history”

  1. […] […]

  2. cerveza said

    Thanks for this article! I found the link to the German DUnit walk through is broken. Here is correct one:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: